website/Dockerfile

32 lines
739 B
Docker

# ----------------------------
# Build stage
# ----------------------------
FROM python:3.11.0-alpine AS builder
RUN apk add --no-cache \
git
ENV POETRY_VERSION=2.2.0
RUN pip install --no-cache-dir "poetry==$POETRY_VERSION" # --break-system-packages is not needed
ENV POETRY_VIRTUALENVS_CREATE=false
ENV POETRY_NO_INTERACTION=1
WORKDIR /app
RUN git clone https://git.stefan.works/stefan/website.git .
RUN poetry install --only main # --no-root
RUN poetry run python -m scripts.patch_flask_frozen
RUN poetry run python freezer.py
# ----------------------------
# Runtime stage
# ----------------------------
FROM nginx:alpine
COPY --from=builder /app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]