-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (32 loc) · 1.22 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
FROM python:3.7-alpine
MAINTAINER Sajia Zafreen
ENV PYTHONUNBUFFERED 1
COPY ./requirements.txt /requirements.txt
# need to add some dependencies to install the package for
# django to communicate with postgres
# for Pillow added jpeg-dev
RUN apk add --update --no-cache postgresql-client jpeg-dev
# apk is the name of the package manager that comes with Alpine, other is
# in the notes
RUN apk add --update --no-cache --virtual .tmp-build-deps \
gcc libc-dev linux-headers postgresql-dev musl-dev zlib zlib-dev
# need to install some temporary packages that need to be installed to
# run the requirements and later it can be removed
RUN pip install -r /requirements.txt
RUN apk del .tmp-build-deps
# remove by the alias
RUN mkdir /app
WORKDIR /app
COPY ./app /app
# the /vol is a subdirectory that shares files with other containers
RUN mkdir -p /vol/web/media
# two files holds the static data , static is for JS, css files
RUN mkdir -p /vol/web/static
RUN adduser -D user
# change the owenership, we have to give persmissions to access the files
# while we are in the root user
RUN chown -R user:user /vol/
# the owner can do anything to the directory, and rest can read and execute
# from the directory
RUN chmod -R 755 /vol/web
USER user