-
Notifications
You must be signed in to change notification settings - Fork 50
/
Dockerfile.min
37 lines (29 loc) · 1.2 KB
/
Dockerfile.min
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
FROM edoburu/django-base-images:py36-stretch-build-onbuild AS build-image
# Node builder
FROM node:9-stretch as frontend-build
RUN mkdir -p /app/src
WORKDIR /app/src
COPY src/package.json src/package-lock.json* /app/src/
RUN npm install
COPY src/gulpfile.js /app/src/
COPY src/frontend/ /app/src/frontend/
RUN npm run gulp
# Start runtime container
FROM edoburu/django-base-images:py36-stretch-runtime-onbuild
ENV DJANGO_SETTINGS_MODULE={{ project_name }}.settings.docker \
UWSGI_MODULE={{ project_name }}.wsgi.docker:application
HEALTHCHECK --interval=5m --timeout=3s CMD curl -f http://localhost:8080/api/health/ || exit 1
COPY --from=frontend-build /app/src/frontend/static /app/src/frontend/static
# Collect static files as root, with gzipped files for uwsgi to serve
# Add CACHE folder for django-compressor to write into
RUN manage.py compilemessages && \
manage.py collectstatic --noinput
#whitenoise does this;
#gzip --keep --best --force --recursive /app/web/static/ && \
COPY deployment/docker/uwsgi-local.ini /usr/local/etc/uwsgi-local.ini
# Tag the docker image
ARG GIT_VERSION
LABEL git-version=$GIT_VERSION
RUN echo $GIT_VERSION > .docker-git-version
# Reduce default permissions
USER app