smaller image
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 4m12s

This commit is contained in:
Karl 2025-07-14 21:15:34 +01:00
parent bdc96504bc
commit 950183542f
2 changed files with 29 additions and 2 deletions

16
.dockerignore Normal file
View File

@ -0,0 +1,16 @@
# Git
.git
.gitignore
# Python
__pycache__/
*.pyc
*.pyo
*.pyd
.venv/
venv/
env/
# IDE/Editor
.vscode/
.idea/

View File

@ -1,4 +1,5 @@
FROM python:3.11-slim-bookworm
# Builder stage
FROM python:3.11-slim-bookworm as builder
RUN apt-get update && apt-get install -y --no-install-recommends \
libglib2.0-0 \
@ -13,8 +14,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
# Final stage
FROM python:3.11-slim-bookworm as final
WORKDIR /app
COPY --from=builder /install /usr/local
COPY . .
RUN chmod +x run.sh
@ -22,6 +29,10 @@ RUN chmod +x run.sh
ARG VERSION
RUN echo $VERSION > VERSION
# Create a non-root user
RUN useradd --create-home appuser
USER appuser
EXPOSE 5000
ENV FLASK_ENV production