-
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (53 loc) · 2.4 KB
/
Dockerfile
File metadata and controls
64 lines (53 loc) · 2.4 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
FROM --platform=$BUILDPLATFORM python:3.12.5-bookworm 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/
# Create config.site to skip problematic configure tests
RUN echo 'ac_cv_func_getcwd_path_max=yes' > /etc/config.site
ENV CONFIG_SITE=/etc/config.site
# 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 m4 \
&& pip install -U 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=gnu23|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.12.5-bookworm
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 "HMI_files/" /usr/src/app/nspanelmanager/HMI_files/
COPY --from=build /MQTTManager/build /MQTTManager/build
# Update container
RUN apt-get update && apt-get -y upgrade
# Install software needed to build the manager
RUN if [ "$IS_DEVEL" == "yes" ]; then apt-get install -y --no-install-recommends cmake build-essential gdb curl npm postgresql-client curl inotify-tools net-tools build-essential protobuf-c-compiler m4 \
&& pip install conan conan-check-updates && conan profile detect --force \
&& echo 'core.cache:storage_path=/MQTTManager/conan_cache/' > ~/.conan2/global.conf \
&& sed -i "s|cppstd=gnu17|cppstd=gnu23|g" /root/.conan2/profiles/default \
&& sed -i "s|build_type=Release|build_type=Debug|g" /root/.conan2/profiles/default \
&& echo "alias ll='ls -lh --color=auto'" >> /etc/bash.bashrc \
#&& rm -rf /var/lib/apt/lists/*
; fi
RUN apt-get install -y nginx
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 8000
CMD ["/bin/bash", "./run_uwsgi.sh"]