-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
53 lines (37 loc) · 1.33 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends gcc libpq-dev python3-dev cron python3-pip xmlsec1 python3-dev libssl-dev libsasl2-dev \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory in the container
WORKDIR /app
# Copy only the requirements file to leverage Docker cache
COPY pyproject.toml poetry.lock /app/
# Install project dependencies
RUN pip install poetry \
&& poetry config virtualenvs.create false \
&& poetry install --with prod --no-interaction --no-ansi
# Copy the current directory contents into the container at /app
COPY website /app
COPY entrypoint.sh /
COPY entrypoint_cron.sh /
ENV DJANGO_SETTINGS_MODULE tosti.settings.production
ENV DJANGO_STATIC_ROOT /static
ENV DJANGO_MEDIA_ROOT /media
RUN mkdir -p $DJANGO_STATIC_ROOT
RUN mkdir -p $DJANGO_MEDIA_ROOT
ENV DJANGO_STATIC_URL /static/
ENV DJANGO_MEDIA_URL /media/
RUN touch /var/log/django.log
RUN mkdir -p /app/cache
RUN python manage.py collectstatic --noinput
RUN chown -R nobody:nogroup $DJANGO_MEDIA_ROOT
RUN chown -R nobody:nogroup /var/log/django.log
RUN chown -R nobody:nogroup /app/cache
RUN mkdir -p /app/tosti/saml
EXPOSE 80
# Command to run uWSGI
CMD ["/bin/sh", "/entrypoint.sh"]