add dockerfile and prep for prod

This commit is contained in:
Tobias Brunner 2025-01-30 15:12:50 +01:00
parent 8c9671602b
commit 9aeab6ee3b
No known key found for this signature in database
5 changed files with 94 additions and 1 deletions

27
Dockerfile Normal file
View file

@ -0,0 +1,27 @@
FROM python:3.13-slim
EXPOSE 8000
WORKDIR /app
ENV PATH="/app/.venv/bin:$PATH"
ENV STATIC_ROOT=/app/staticfiles
ENV MEDIA_ROOT=/app/mediafiles
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Install Caddy
COPY --from=docker.io/caddy:latest /usr/bin/caddy /usr/local/bin/caddy
COPY docker/run.sh /usr/local/bin/runhub.sh
ADD . /app
RUN uv sync --frozen
RUN uv pip install gunicorn --no-cache-dir \
&& chmod a+x /usr/local/bin/runhub.sh \
&& SECRET_KEY= python -m hub collectstatic --noinput
COPY docker/Caddyfile /etc/caddy/Caddyfile
CMD ["/usr/local/bin/runhub.sh"]