forked from st-tech/ppf-contact-solver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (34 loc) · 932 Bytes
/
Dockerfile
File metadata and controls
41 lines (34 loc) · 932 Bytes
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
# File: Dockerfile
# Author: Ryoichi Ando (ryoichi.ando@zozo.com)
# License: Apache v2.0
ARG IMAGE
FROM $IMAGE
ARG MODE
ENV NVIDIA_DRIVER_CAPABILITIES=utility,compute
ENV LANG=en_US.UTF-8
ENV PROJ_NAME=ppf-contact-solver
ENV BUILT_MODE=$MODE
COPY . /root/${PROJ_NAME}
WORKDIR /root/${PROJ_NAME}
RUN echo "building in ${MODE} mode"
RUN if [ "$MODE" = "compiled" ]; then \
/root/.cargo/bin/cargo build --release; \
elif [ "$MODE" = "base" ]; then \
apt-get update && \
apt-get install -y python3 python3-venv && \
python3 warmup.py && \
/root/.cargo/bin/cargo build && \
rm -rf /root/${PROJ_NAME}; \
else \
echo "unknown build mode ${BUILT_MODE}"; \
exit 1; \
fi
WORKDIR /root
RUN rm -rf /var/lib/apt/lists/*
CMD ["/bin/sh", "-c", "\
if [ \"$BUILT_MODE\" = \"compiled\" ]; then \
cd /root/${PROJ_NAME} && python3 warmup.py jupyter; \
elif [ \"$BUILT_MODE\" = \"base\" ]; then \
bash; \
fi\
"]