-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
42 lines (26 loc) · 809 Bytes
/
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
FROM python:2-slim
LABEL maintainer="[email protected]"
# Definir uid y gid custom. Por defecto se asigna 1000:1000
ARG UID=1000
ARG GID=1000
ARG APPPATH=/var/www/django-pytest
ARG USERNAME=djangouser
# Create a user so our program doesn't run as root.
RUN groupadd -r ${USERNAME} -g ${GID} &&\
useradd -r -g ${USERNAME} -u ${UID} -d /home/${USERNAME} -s /sbin/nologin -c "Docker image user" ${USERNAME}
# Crear carpeta del proyecto
RUN mkdir -p ${APPPATH}
# Asigno los permisos para el usuario
RUN chown -R ${USERNAME}:${USERNAME} ${APPPATH}
# Cambio de directorio
WORKDIR ${APPPATH}
# Instalo los requirements
RUN pip install \
"Django==1.8" \
pytest \
pytest-bdd \
pytest-django
VOLUME ${APPPATH}
EXPOSE 8000
USER ${USERNAME}
CMD ["/sbin/init"]