forked from mozilla/generic-python-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (32 loc) · 1.08 KB
/
Copy pathDockerfile
File metadata and controls
43 lines (32 loc) · 1.08 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
FROM python:3
MAINTAINER Frank Bertsch <frank@mozilla.com>
ARG APP_NAME=python-application
ENV APP_NAME=${APP_NAME}
# Guidelines here: https://github.com/mozilla-services/Dockerflow/blob/master/docs/building-container.md
ARG USER_ID="10001"
ARG GROUP_ID="app"
ARG HOME="/app"
ENV HOME=${HOME}
RUN groupadd --gid ${USER_ID} ${GROUP_ID} && \
useradd --create-home --uid ${USER_ID} --gid ${GROUP_ID} --home-dir /app ${GROUP_ID}
# List packages here
RUN apt-get update && \
apt-get install -y --no-install-recommends \
file \
gcc \
libwww-perl && \
apt-get autoremove -y && \
apt-get clean
# Upgrade pip
RUN pip install --upgrade pip
WORKDIR ${HOME}
ADD requirements requirements/
RUN pip install -r requirements/requirements.txt
RUN pip install -r requirements/test_requirements.txt
ADD . ${HOME}/${APP_NAME}
ENV PATH $PATH:${HOME}/${APP_NAME}/bin
RUN pip install -e ${HOME}/${APP_NAME}
# Drop root and change ownership of the application folder to the user
RUN chown -R ${USER_ID}:${GROUP_ID} ${HOME}
USER ${USER_ID}
ENTRYPOINT ["entrypoint"]