-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathDockerfile
61 lines (45 loc) · 1.71 KB
/
Dockerfile
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
# TODO: Please set your custom image here and adapt the Dockerfile/entrypoint.sh accordingly
FROM joseluisq/static-web-server:2.0.2-alpine as production
#
# USAGE:
# cd services/dy-static-file-server
# docker build -f docker/custom/Dockerfile -t dy-static-file-server:prod .
# docker run dy-static-file-server:prod
#
ARG PYTHON_VERSION="3.8.15-r0"
ARG WORKDIR="/workdir"
ENV SC_BUILD_TARGET=production
ENV SERVER_ROOT="/www"
ENV INPUT_FOLDER="${SERVER_ROOT}/inputs"
ENV OUTPUT_FOLDER="${SERVER_ROOT}/outputs"
ENV SERVER_PORT=8080
ENV SERVER_LOG_LEVEL=debug
# creating own project's user
ENV SC_USER_ID 9004
ENV SC_USER_NAME scudy
RUN adduser -D -u ${SC_USER_ID} -s /bin/sh -h /home/${SC_USER_NAME} ${SC_USER_NAME}
LABEL maintainer=GitHK
RUN apk add --update --no-cache \
"python3=${PYTHON_VERSION}" \
py3-pip \
su-exec
RUN pip3 install --upgrade \
pip==21.3.1 \
virtualenv==20.10.0
# create and activate virtual environment
RUN mkdir -p /venv && \
python3 -m venv /opt/venv
ENV PATH="/venv/bin:$PATH"
# add additional directories
RUN mkdir -p ${WORKDIR} && chown ${SC_USER_NAME}:${SC_USER_NAME} ${WORKDIR} && \
mkdir -p /docker && chown ${SC_USER_NAME}:${SC_USER_NAME} /docker
COPY --chown=${SC_USER_NAME}:${SC_USER_NAME} docker/custom/*.sh /docker
# add python app requirements
COPY requirements/base.txt /tmp/requirements.txt
RUN pip3 install -r /tmp/requirements.txt
COPY --chown=${SC_USER_NAME}:${SC_USER_NAME} static-content/hello-world.txt /www/hello-world.txt
COPY --chown=${SC_USER_NAME}:${SC_USER_NAME} src/dy_static_file_server ${WORKDIR}/dy_static_file_server
WORKDIR ${WORKDIR}/dy_static_file_server
EXPOSE 8080
ENTRYPOINT ["/bin/sh", "/docker/entrypoint.sh"]
CMD ["/docker/boot.sh"]