-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
123 lines (91 loc) · 5.56 KB
/
Dockerfile
File metadata and controls
123 lines (91 loc) · 5.56 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# syntax=docker/dockerfile:1
FROM bringauto/cpp-build-environment:latest AS cpp_build_base
ARG CMCONF_VERSION=master
RUN mkdir -p /home/bringauto/cmconf && \
wget -O /home/bringauto/cmconf/CMCONF_FLEET_PROTOCOLConfig.cmake \
https://github.com/bringauto/packager-fleet-protocol-context/raw/"$CMCONF_VERSION"/config/CMCONF_FLEET_PROTOCOLConfig.cmake
FROM cpp_build_base AS mission_module_builder
ARG MISSION_MODULE_VERSION=v1.3.2
WORKDIR /home/bringauto/modules
ARG CMLIB_REQUIRED_ENV_TMP_PATH=/home/bringauto/modules/cmlib_cache
RUN mkdir -p /home/bringauto/modules/cmake && \
wget -O CMakeLists.txt https://github.com/bringauto/mission-module/raw/"$MISSION_MODULE_VERSION"/CMakeLists.txt && \
wget -O CMLibStorage.cmake https://github.com/bringauto/mission-module/raw/"$MISSION_MODULE_VERSION"/CMLibStorage.cmake && \
wget -O cmake/Dependencies.cmake https://github.com/bringauto/mission-module/raw/"$MISSION_MODULE_VERSION"/cmake/Dependencies.cmake
WORKDIR /home/bringauto/modules/package_build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DBRINGAUTO_GET_PACKAGES_ONLY=ON \
-DCMCONF_FLEET_PROTOCOL_DIR=/home/bringauto/cmconf
# Build mission module
WORKDIR /home/bringauto
ADD --chown=bringauto:bringauto https://github.com/bringauto/mission-module.git#$MISSION_MODULE_VERSION mission-module
WORKDIR /home/bringauto/mission-module/_build
RUN cmake -DCMAKE_BUILD_TYPE=Release -DBRINGAUTO_INSTALL=ON \
-DCMAKE_INSTALL_PREFIX=/home/bringauto/modules/mission_module/ \
-DFLEET_PROTOCOL_BUILD_MODULE_GATEWAY=OFF \
-DCMCONF_FLEET_PROTOCOL_DIR=/home/bringauto/cmconf .. && \
make install
FROM cpp_build_base AS io_module_builder
ARG IO_MODULE_VERSION=v1.3.4
WORKDIR /home/bringauto/modules
ARG CMLIB_REQUIRED_ENV_TMP_PATH=/home/bringauto/modules/cmlib_cache
RUN mkdir -p /home/bringauto/modules/cmake && \
wget -O CMakeLists.txt https://github.com/bringauto/io-module/raw/"$IO_MODULE_VERSION"/CMakeLists.txt && \
wget -O CMLibStorage.cmake https://github.com/bringauto/io-module/raw/"$IO_MODULE_VERSION"/CMLibStorage.cmake && \
wget -O cmake/Dependencies.cmake https://github.com/bringauto/io-module/raw/"$IO_MODULE_VERSION"/cmake/Dependencies.cmake
WORKDIR /home/bringauto/modules/package_build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DBRINGAUTO_GET_PACKAGES_ONLY=ON \
-DCMCONF_FLEET_PROTOCOL_DIR=/home/bringauto/cmconf
# Build io module
WORKDIR /home/bringauto
ADD --chown=bringauto:bringauto https://github.com/bringauto/io-module.git#$IO_MODULE_VERSION io-module
WORKDIR /home/bringauto/io-module/_build
RUN cmake -DCMAKE_BUILD_TYPE=Release -DBRINGAUTO_INSTALL=ON \
-DCMAKE_INSTALL_PREFIX=/home/bringauto/modules/io_module/ \
-DFLEET_PROTOCOL_BUILD_MODULE_GATEWAY=OFF \
-DCMCONF_FLEET_PROTOCOL_DIR=/home/bringauto/cmconf .. && \
make install
FROM cpp_build_base AS transparent_module_builder
ARG TRANSPARENT_MODULE_VERSION=v1.0.4
WORKDIR /home/bringauto/modules
ARG CMLIB_REQUIRED_ENV_TMP_PATH=/home/bringauto/modules/cmlib_cache
RUN mkdir -p /home/bringauto/modules/cmake && \
wget -O CMakeLists.txt https://github.com/bringauto/transparent-module/raw/"$TRANSPARENT_MODULE_VERSION"/CMakeLists.txt && \
wget -O CMLibStorage.cmake https://github.com/bringauto/transparent-module/raw/"$TRANSPARENT_MODULE_VERSION"/CMLibStorage.cmake && \
wget -O cmake/Dependencies.cmake https://github.com/bringauto/transparent-module/raw/"$TRANSPARENT_MODULE_VERSION"/cmake/Dependencies.cmake
WORKDIR /home/bringauto/modules/package_build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DBRINGAUTO_GET_PACKAGES_ONLY=ON \
-DCMCONF_FLEET_PROTOCOL_DIR=/home/bringauto/cmconf
# Build transparent module
WORKDIR /home/bringauto/
ADD --chown=bringauto:bringauto https://github.com/bringauto/transparent-module.git#$TRANSPARENT_MODULE_VERSION transparent-module
WORKDIR /home/bringauto/transparent-module/_build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DBRINGAUTO_INSTALL=ON \
-DCMAKE_INSTALL_PREFIX=/home/bringauto/modules/transparent_module/ \
-DFLEET_PROTOCOL_BUILD_MODULE_GATEWAY=OFF \
-DCMCONF_FLEET_PROTOCOL_DIR=/home/bringauto/cmconf && \
make install
FROM bringauto/python-environment:latest
# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1
WORKDIR /home/bringauto
# Install Python dependencies while ignoring overriding system packages inside the container
COPY requirements.txt /home/bringauto/external_server/requirements.txt
COPY --chown=bringauto:bringauto lib /home/bringauto/external_server/lib/
# Workdir needs to be set before installing requirements because of the local protobuf package
WORKDIR /home/bringauto/external_server
RUN "$PYTHON_ENVIRONMENT_PYTHON3" -m pip install --no-cache-dir -r /home/bringauto/external_server/requirements.txt
# Copy project files into the docker image
COPY external_server /home/bringauto/external_server/external_server/
COPY config/for_docker.json /home/bringauto/external_server/config/for_docker.json
# Copy module libraries
COPY --from=mission_module_builder /home/bringauto/modules /home/bringauto/modules
COPY --from=io_module_builder /home/bringauto/modules /home/bringauto/modules
COPY --from=transparent_module_builder /home/bringauto/modules /home/bringauto/modules
USER 5000:5000
RUN mkdir -p /home/bringauto/log/
# Set the entrypoint
# "bash" and "-c" have to be used to be able to use environment variables
# $0 and $@ are needed to pass arguments to the script
ENTRYPOINT [ "bash", "-c", "$PYTHON_ENVIRONMENT_PYTHON3 -m external_server $0 $@" ]
CMD [ "/home/bringauto/external_server/config/for_docker.json" ]