-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (24 loc) · 875 Bytes
/
Dockerfile
File metadata and controls
34 lines (24 loc) · 875 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
33
34
#install python
FROM python:3.12-slim
# tells to python don't write pyc codes like cache which we don't need
ENV PYTHONDONTWRITEBYTECODE=1
# to display error message for debugging
ENV PYTHONUNBUFFERED=1
# run all commands in the app folder
WORKDIR /app
# create user
RUN adduser --disabled-password --gecos "" django-user
# create media and static folders and give ownership to django user
RUN mkdir -p app/static app/media && chown -R django-user:django-user app/static app/media
# copy everything from requirements folder
COPY app/requirements.txt .
# upgrade pip and install from requirements.txt
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
COPY app/ .
# make user django user
USER django-user
# expose port so it runs in 8000
EXPOSE 8000
# default command
CMD ["gunicorn", "core.wsgi:application", "--bind", "0.0.0.0:8000"]