This repository has been archived by the owner on Dec 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Dockerfile.dev
71 lines (56 loc) · 1.99 KB
/
Dockerfile.dev
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
68
69
70
71
## Node container:
FROM node:10 as npm
WORKDIR /opt/npm
COPY package.json package-lock.json /opt/npm/
RUN npm install
## Python container:
FROM python:3.6-slim
LABEL maintainer="Jannis Leidel <jezdez@mozilla.com>"
ENV PYTHONUNBUFFERED=1 \
PYTHONPATH=/app/ \
DJANGO_CONFIGURATION=Dev \
DEVELOPMENT=1 \
PORT=8000
EXPOSE $PORT
# add a non-privileged user for installing and running the application
# don't use --create-home option to prevent populating with skeleton files
RUN mkdir /app && \
chown 10001:10001 /app && \
groupadd --gid 10001 app && \
useradd --no-create-home --uid 10001 --gid 10001 --home-dir /app app
# install a few essentials and clean apt caches afterwards
RUN mkdir -p \
/usr/share/man/man1 \
/usr/share/man/man2 \
/usr/share/man/man3 \
/usr/share/man/man4 \
/usr/share/man/man5 \
/usr/share/man/man6 \
/usr/share/man/man7 \
/usr/share/man/man8 && \
apt-get update && \
apt-get install -y --no-install-recommends \
apt-transport-https build-essential curl git gnupg libpq-dev \
postgresql-client gettext sqlite3 libffi-dev \
graphviz enchant && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Create static and npm roots
RUN mkdir -p /opt/npm /opt/static && \
chown -R 10001:10001 /opt
# Install Python dependencies
COPY requirements/*.txt /tmp/requirements/
# Switch to /tmp to install dependencies outside home dir
WORKDIR /tmp
RUN pip install --no-cache-dir -r requirements/all.txt
USER 10001
# Copy Node dependencies from NPM container
COPY --from=npm /opt/npm /opt/npm
# Switch back to home directory
WORKDIR /app
# Using /bin/bash as the entrypoint works around some volume mount issues on Windows
# where volume-mounted files do not have execute bits set.
# https://github.com/docker/compose/issues/2301#issuecomment-154450785 has additional background.
ENTRYPOINT ["/bin/bash", "/app/bin/run"]
CMD ["web-dev"]