Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (40 loc) · 1.41 KB
/
Copy pathDockerfile
File metadata and controls
57 lines (40 loc) · 1.41 KB
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
54
55
56
57
FROM python:3.14-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 python3-pip xmlsec1 python3-dev libssl-dev libsasl2-dev curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install uv
ADD https://astral.sh/uv/install.sh /uv-installer.sh
RUN sh /uv-installer.sh && rm /uv-installer.sh
ENV PATH="/root/.local/bin/:$PATH"
ENV UV_NO_DEV=1
# Set the working directory in the container
WORKDIR /app
# Copy only the requirements file to leverage Docker cache
COPY pyproject.toml uv.lock /app/
# Install dependencies
RUN uv sync --locked --group prod
# Copy the current directory contents into the container at /app
COPY website /app
COPY entrypoint.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 uv run 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
ARG SENTRY_RELEASE
ENV SENTRY_RELEASE=${SENTRY_RELEASE}
EXPOSE 80
# Command to run uWSGI
CMD ["/bin/sh", "/entrypoint.sh"]