Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve Dockerfile #18

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
##### Builder Stage #####
FROM python:3.12-slim-bookworm as builder
##### Base Stage #####
FROM python:3.12-slim-bookworm as base

# Set default path
ENV PATH="/app/.venv/bin:${PATH}"

##### Builder Stage #####
FROM base as builder

# Set default workdir
WORKDIR /app

Expand All @@ -21,20 +24,13 @@ COPY templates ./templates
COPY static ./static

##### Final Stage #####
FROM python:3.12-slim-bookworm

# Disable Prompt During Packages Installation
ARG DEBIAN_FRONTEND=noninteractive

# Set default path
ENV PATH="/app/.venv/bin:${PATH}"
ENV PYTHONPATH /app
FROM base

# Copy content from builder stage
COPY --from=builder /app /app

# Add qrcode user and create directories
RUN useradd -m qrcode && mkdir -p /app
RUN useradd -m qrcode

# Set permissions
RUN chown -R qrcode:qrcode /app
Expand Down