update Dockerfile

This commit is contained in:
Grégory Lebreton 2025-05-11 22:37:55 +02:00
parent 5574264368
commit 09b37fa1a8
2 changed files with 23 additions and 9 deletions

View File

@ -1,12 +1,25 @@
FROM python:3.11-slim-bookworm
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# BUILD
FROM python:3.11-slim AS builder
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
COPY app/. .
COPY app/requirements.txt .
RUN pip install --prefix=/install --no-cache-dir -r requirements.txt
CMD ["gunicorn", "-w", "4", "wsgi:app", "--bind", "0.0.0.0:8000"]
# FINAL
FROM python:3.11-alpine
WORKDIR /app
RUN apk update && \
apk add --no-cache libffi openssl rsync curl hugo python3 py3-pip
COPY --from=builder /install /usr/local
COPY app/ /app
RUN apk update && \
apk add --no-cache libffi openssl rsync curl
EXPOSE 5000
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 CMD curl -f http://localhost:5000/ || exit 1
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5000", "main:app"]

View File

@ -103,4 +103,5 @@ docker compose down && docker compose up -d
## TO DO :bookmark_tabs:
- [ ] Automate certbot renew
- [ ] Automate certbot renew
- [ ] Test admin panel