forked from upy/bootcamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (23 loc) · 673 Bytes
/
Dockerfile
File metadata and controls
32 lines (23 loc) · 673 Bytes
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
# pull official base image
FROM python:3.8-alpine
# set work directory
WORKDIR /app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV DEBUG 0
# install psycopg2
RUN apk update \
&& apk add --virtual build-essential gcc gettext python3-dev musl-dev \
&& apk add postgresql-dev \
&& pip install gunicorn
COPY ./ecommerce/requirements.txt .
RUN pip install -r requirements.txt
# copy project
COPY ./ecommerce .
RUN mkdir /app/static && python manage.py collectstatic --noinput
# add and run as non-root user
RUN adduser -D wwwuser
USER wwwuser
# run gunicorn
CMD gunicorn ecommerce.wsgi:application --bind 0.0.0.0:$PORT