-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
63 lines (51 loc) · 1.86 KB
/
Copy pathDockerfile
File metadata and controls
63 lines (51 loc) · 1.86 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
FROM python:3.14-alpine
ARG BUILD_ENV
ARG IMAGE_VERSION
RUN if [ "$BUILD_ENV" = "rex" ]; then echo "Change depends" \
&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
&& pip config set global.index-url https://proxpi.h.rexzhang.com/index/ \
&& pip config set install.trusted-host proxpi.h.rexzhang.com \
; fi
COPY ./requirements.d /app/requirements.d
# depends
RUN \
# install depends \
apk add --no-cache --virtual .build-deps build-base libffi-dev \
# -- for i18n
&& apk add --no-cache gettext \
# -- for py
&& pip install --no-cache-dir -r /app/requirements.d/docker.txt \
# cleanup --- \
&& apk del .build-deps \
&& rm -rf /root/.cache \
&& find /usr/local/lib/python*/ -type f -name '*.py[cod]' -delete \
&& find /usr/local/lib/python*/ -type d -name "__pycache__" -delete \
# create non-root user ---
&& apk add --no-cache su-exec \
# prepare data path --- \
&& mkdir /data \
&& mkdir /data/lexicon_tld_set
COPY ddns_clienter /app/ddns_clienter
COPY manage.py /app
COPY runserver.py /app
COPY entrypoint.sh /app
WORKDIR /app
EXPOSE 8000
ENV PYTHONPATH=/app
ENV TLDEXTRACT_CACHE_PATH=/data/lexicon_tld_set
ENV DJANGO_SETTINGS_MODULE="ddns_clienter.settings"
ENV DEPLOY_STAGE="prd"
ENV DEPLOY_IN_CONTAINER="true"
ENV DATA_PATH="/data"
ENV CONFIG_TOML="/etc/ddns-clienter.toml"
ENV PBULIC_INSIDE_API="true"
ENV SENTRY_DSN=""
# i18n
RUN ./manage.py compilemessages --ignore venv \
&& ./manage.py collectstatic --no-input
CMD /app/entrypoint.sh
LABEL org.opencontainers.image.title="DDNS Clienter"
LABEL org.opencontainers.image.version="$IMAGE_VERSION"
LABEL org.opencontainers.image.authors="Rex Zhang"
LABEL org.opencontainers.image.url="https://hub.docker.com/r/ray1ex/ddns-clienter"
LABEL org.opencontainers.image.source="https://github.com/rexzhang/ddns-clienter"