Files
website-v2/docker/Dockerfile
2023-04-29 16:41:27 -05:00

43 lines
1017 B
Docker

# syntax = docker/dockerfile:experimental
FROM python:3.11-slim AS builder-py
RUN apt update && apt install -y build-essential gcc python-dev libpq-dev postgresql-client && rm -rf /var/lib/apt/lists/*
RUN pip install -U pip
COPY ./requirements.txt ./code/requirements.txt
RUN python3 -m venv /venv
RUN --mount=type=cache,target=/root/.cache \
. /venv/bin/activate && \
pip install -U pip && \
pip install --no-compile -r /code/requirements.txt
FROM python:3.11-slim AS release
RUN apt update && apt install -y git libpq-dev && rm -rf /var/lib/apt/lists/*
ENV PATH /venv/bin:/bin:/usr/bin:/usr/local/bin
ENV PYTHONDONTWRITEBYTECODE=true
ENV PYTHONPATH /code
ENV PYTHONUNBUFFERED 1
ENV PYTHONWARNINGS ignore
RUN mkdir /code
COPY --from=builder-py /venv/ /venv/
COPY --from=builder-py /code/ /code/
COPY . /code/
WORKDIR /code
CMD ["gunicorn", "-c", "/code/gunicorn.conf.py", "config.wsgi"]
ARG TAG
ENV IMAGE_TAG=$TAG
LABEL Description="Boost.org" Vendor="REVSYS"
LABEL Version="${IMAGE_TAG}"