-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
67 lines (54 loc) · 1.78 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
62
63
64
65
66
67
FROM python:3.6-slim
# Config
ENV APP_DIR=/app \
DJANGO_SETTINGS_MODULE=config.settings \
DJANGO_STATIC_ROOT=/static
# Set up volumes.
VOLUME ["/etc/nginx/conf.d", "${DJANGO_STATIC_ROOT}"]
# Add scripts to do good Docker package management.
COPY docker/install_packages.sh /usr/bin/install_packages
COPY docker/upgrade_packages.sh /usr/bin/upgrade_packages
COPY docker/remove_packages.sh /usr/bin/remove_packages
# Ensure that Python outputs everything that's printed inside
# the application rather than buffering it.
ENV PYTHONUNBUFFERED=1
# Don't cache pip packages (pip uses falsey values like 0 to indicate a flag is set for some reason).
ENV PIP_NO_CACHE_DIR=0
# Expose the gunicorn port.
EXPOSE 80
# Set up health check.
RUN install_packages curl
HEALTHCHECK CMD curl -f http://127.0.0.1/health-check/ || exit 1
# Setup Docker entrypoint.
COPY docker/docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
# Install Python dependencies.
COPY Pipfile Pipfile.lock ./
ARG JFROG_USERNAME=
ARG JFROG_ACCESS_TOKEN=
ENV PIPENV_ARGS="" \
JFROG_USERNAME=${JFROG_USERNAME} \
JFROG_ACCESS_TOKEN=${JFROG_ACCESS_TOKEN}
RUN set -ex; \
buildDeps=" \
gcc \
"; \
install_packages $buildDeps; \
pip install pipenv; \
pipenv install --deploy --system $PIPENV_ARGS; \
pip uninstall --yes pipenv; \
remove_packages $buildDeps;
# Copy app.
COPY . ${APP_DIR}
WORKDIR ${APP_DIR}
# Set log level and Everest environment.
ENV APP_ENVIRONMENT=dev
ARG LOG_LEVEL=INFO
ENV EVEREST_LOG_LEVEL=${LOG_LEVEL}
# Environment variables that will change on every build.
ARG GIT_HASH=
ARG JENKINS_BUILD=
ENV EVEREST_GIT_HASH=${GIT_HASH} \
EVEREST_JENKINS_BUILD=${JENKINS_BUILD}
# Upgrade system packages to get latest security updates.
RUN upgrade_packages