-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
36 lines (28 loc) · 1.08 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
# Docker image for Tutti with static files baked in.
#
#
# Static files are handled by WhiteNoise. Media files are stored in /app/media,
# so that folder should be mounted as a Docker volume.
#
# The default command runs the gunicorn server on port 8000. You need to run
# migrate yourself, e.g. using `docker run tutti python manage.py migrate
# --noinput`.
FROM python:3.11
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
WORKDIR /app/src
RUN pip install --no-cache-dir gunicorn==22.0.0 psycopg==3.1.19
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# Setup static and media folders
ENV DJANGO_STATIC_ROOT=/app/static DJANGO_MEDIA_ROOT=/app/media DJANGO_SECRET_KEY=dummy DJANGO_WHITENOISE=1
RUN mkdir /app/static /app/media && python manage.py collectstatic --noinput
ENV DJANGO_SECRET_KEY=''
# Create user
RUN useradd -u 1001 appuser && chown appuser /app/media
USER appuser
# The SHA1 hash of the commit
ARG SOURCE_COMMIT
ENV SOURCE_COMMIT=$SOURCE_COMMIT
# By default launch gunicorn on :8000
CMD ["gunicorn", "-w", "3", "-b", "0.0.0.0:8000", "tutti.wsgi"]