smaller image
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 4m12s
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 4m12s
This commit is contained in:
parent
bdc96504bc
commit
950183542f
16
.dockerignore
Normal file
16
.dockerignore
Normal file
@ -0,0 +1,16 @@
|
||||
# Git
|
||||
.git
|
||||
.gitignore
|
||||
|
||||
# Python
|
||||
__pycache__/
|
||||
*.pyc
|
||||
*.pyo
|
||||
*.pyd
|
||||
.venv/
|
||||
venv/
|
||||
env/
|
||||
|
||||
# IDE/Editor
|
||||
.vscode/
|
||||
.idea/
|
15
dockerfile
15
dockerfile
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user