-
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (50 loc) · 2.37 KB
/
Dockerfile
File metadata and controls
66 lines (50 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# syntax=docker/dockerfile:1
# check=error=true
FROM python:3.11 AS build
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG no_mqttmanager_build
ARG IS_DEVEL
WORKDIR /MQTTManager
SHELL ["/bin/bash", "-c"]
RUN echo "Running on $BUILDPLATFORM, building for $TARGETPLATFORM"
COPY MQTTManager/ /MQTTManager/
# Only build MQTTManager during Docker build if is is not a devel mode.
RUN if [ "$IS_DEVEL" != "yes" ]; then apt-get update \
&& apt-get -y install cmake build-essential curl \
&& pip install conan; fi
RUN if [ "$IS_DEVEL" != "yes" ]; then conan profile detect --force && echo 'core.cache:storage_path=/MQTTManager/conan_cache/' > ~/.conan2/global.conf \
&& sed -i "s|cppstd=gnu14|cppstd=gnu17|g" /root/.conan2/profiles/default \
&& sed -i "s|build_type=Release|build_type=Debug|g" /root/.conan2/profiles/default; fi
RUN if [ -z "$no_mqttmanager_build" ]; then /bin/bash /MQTTManager/compile_mqttmanager.sh --target-platform "$TARGETPLATFORM" --strip; else echo "Not building MQTTManager."; fi
FROM python:3.11
ARG no_mqttmanager_build
ARG IS_DEVEL
WORKDIR /usr/src/app
SHELL ["/bin/bash", "-c"]
COPY web/ /usr/src/app/
COPY nginx/sites-enabled/ /etc/nginx/sites-enabled/
COPY nginx/sites-templates/ /etc/nginx/sites-templates/
COPY --from=build /MQTTManager/build /MQTTManager/build
# Update container
RUN apt-get update \
&& apt-get -y upgrade
# Install build tools into the container if this is a devel build
RUN if [ "$IS_DEVEL" == "yes" ]; then apt-get -y install cmake build-essential curl npm gdb \
&& pip install conan pipx; else echo "Not building MQTTManager."; fi
RUN if [ "$IS_DEVEL" == "yes" ]; then conan profile detect --force && echo 'core.cache:storage_path=/MQTTManager/conan_cache/' > ~/.conan2/global.conf \
&& sed -i "s|cppstd=gnu14|cppstd=gnu17|g" /root/.conan2/profiles/default \
&& sed -i "s|build_type=Release|build_type=Debug|g" /root/.conan2/profiles/default \
&& pip install pipx \
&& python3 -m userpath append ~/.local/bin \
&& source ~/.bashrc \
&& pipx install gdbgui; \
fi
# Install software needed to build and run the manager
RUN apt-get install -y --no-install-recommends \
postgresql-client curl inotify-tools net-tools nginx build-essential \
&& rm -rf /var/lib/apt/lists/*
RUN pip install -r requirements.txt # Install python packages
RUN echo "alias ll='ls -lh --color=auto'" >> /etc/bash.bashrc
EXPOSE 8000
CMD ["/bin/bash", "./run_uwsgi.sh"]