42 lines
974 B
Docker
42 lines
974 B
Docker
# ----------------------------
|
|
# Build stage
|
|
# ----------------------------
|
|
FROM python:3.11.0-alpine AS builder
|
|
|
|
RUN apk add --no-cache \
|
|
# python3 \
|
|
# py3-pip \
|
|
git \
|
|
# build-base \
|
|
# curl
|
|
|
|
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 patch-frozen
|
|
RUN poetry run python freezer.py
|
|
|
|
# ----------------------------
|
|
# Runtime stage
|
|
# ----------------------------
|
|
FROM alpine:3.20
|
|
|
|
RUN apk add --no-cache nginx
|
|
|
|
RUN rm -rf /usr/share/nginx/html/* \
|
|
&& mkdir -p /run/nginx
|
|
|
|
COPY --from=builder /app/build /usr/share/nginx/html
|
|
COPY container-nginx.conf /etc/nginx/nginx.conf
|
|
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|