-
Notifications
You must be signed in to change notification settings - Fork 28
/
Dockerfile.template
60 lines (46 loc) · 1.85 KB
/
Dockerfile.template
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
# hadolint ignore=DL3006
FROM python
LABEL maintainer="Victor R. Santos <[email protected]>"
ARG DEFAULT_UID=373
ARG DEFAULT_GID=373
ARG ETE_VERSION=master
ARG ETE_REPO="https://github.com/etesync/server.git"
ENV BASE_DIR /etebase
ENV DATA_DIR /data
ENV MEDIA_ROOT ${DATA_DIR}/media
ENV ETEBASE_EASY_CONFIG_PATH ${DATA_DIR}/etebase-server.ini
ENV SECRET_FILE ${DATA_DIR}/secret.txt
ENV STATIC_ROOT /srv/etebase/static
ENV SERVER="http"
ENV PORT 3735
WORKDIR ${BASE_DIR}
# OS packages and deps installation
# hadolint ignore=DL3008,DL3018
RUN set -eux; \
# Prepare packages required by the base image
#%%_PREPARE_OS_%%
# Download Etebase and install dependencies
git clone --depth=1 --branch=${ETE_VERSION} "${ETE_REPO}" "${BASE_DIR}"; \
/usr/local/bin/python -m pip install --no-cache-dir --progress-bar off --upgrade pip; \
pip install --no-cache-dir --progress-bar off -r "${BASE_DIR}/requirements.txt" uwsgi 'uvicorn[standard]'; \
# Remove packages no longer required by the base image
#%%_CLEAN_OS_%%
# Clear Downloads and set permissions
rm -r "${BASE_DIR}/.git"; \
chown -R "${DEFAULT_UID}":"${DEFAULT_GID}" "${BASE_DIR}"
# Etebase directories and user setup
RUN set -eux; \
addgroup --system --gid "${DEFAULT_GID}" etebase; \
adduser --system --no-create-home --disabled-password \
--gecos '' --home ${BASE_DIR} --ingroup etebase --uid "${DEFAULT_UID}" etebase; \
mkdir -p "${MEDIA_ROOT}" "${STATIC_ROOT}"; \
chown -R "${DEFAULT_UID}":"${DEFAULT_GID}" "${DATA_DIR}" "${STATIC_ROOT}"; \
chmod -R 750 "${DATA_DIR}"; \
export DJANGO_STATIC_ROOT="${STATIC_ROOT}"; \
"${BASE_DIR}"/manage.py collectstatic --no-input; \
rm "${BASE_DIR}/secret.txt"
COPY --chown=${DEFAULT_UID}:${DEFAULT_GID} context /
USER etebase:etebase
EXPOSE ${PORT}
VOLUME /data
ENTRYPOINT ["/entrypoint.sh"]