This repository has been archived on 2025-03-03. You can view files and clone it, but cannot push or open issues or pull requests.
facturio/Dockerfile

84 lines
1.8 KiB
Text
Raw Normal View History

2025-02-24 15:48:52 +01:00
ARG PYTHON_VERSION=3.13
2025-02-24 23:43:55 +01:00
ARG CODENAME=bookworm
ARG UV_PROJECT_ENVIRONMENT=/home/runner/.venv
2025-02-24 15:48:52 +01:00
2025-02-24 23:43:55 +01:00
FROM python:${PYTHON_VERSION}-slim-${CODENAME} AS base
2025-02-24 15:48:52 +01:00
2025-02-24 23:43:55 +01:00
ARG POSTGRES_VERSION=17
ARG CODENAME
2025-02-24 15:48:52 +01:00
ENV PYTHONUNBUFFERED=1 \
PIP_DISABLE_PIP_VERSION_CHECK=on \
DEBIAN_FRONTEND=noninteractive
RUN : \
&& apt-get update \
&& apt-get install -y \
build-essential \
gnupg \
wget \
2025-02-24 23:43:55 +01:00
# git \
2025-02-24 15:48:52 +01:00
gettext \
&& rm -rf /var/lib/apt/lists* \
&& :
2025-02-24 23:43:55 +01:00
2025-02-24 15:48:52 +01:00
RUN : \
2025-02-24 23:43:55 +01:00
&& echo "deb https://apt.postgresql.org/pub/repos/apt ${CODENAME}-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
2025-02-24 15:48:52 +01:00
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& apt update \
&& apt install -y postgresql-client-${POSTGRESQL_VERSION} libpq-dev \
&& rm -rf /var/lib/apt/lists* \
&& :
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/
FROM base AS deps
RUN adduser --disabled-password runner
USER runner
WORKDIR /app
2025-02-24 23:43:55 +01:00
ARG UV_PROJECT_ENVIRONMENT
ENV UV_PROJECT_ENVIRONMENT=${UV_PROJECT_ENVIRONMENT} \
2025-02-24 15:48:52 +01:00
UV_PYTHON_DOWNLOADS=never
RUN --mount=type=bind,target=/app,source=. \
: \
&& uv sync --frozen \
&& :
ENTRYPOINT [ "/app/scripts/entrypoint.sh" ]
FROM deps AS dev
ARG UID=1000
ARG GID=1000
USER root
RUN usermod -u ${UID} runner && groupmod -g ${GID} runner
ENV PATH=${UV_PROJECT_ENVIRONMENT}/bin:${PATH}
WORKDIR /app
USER runner
CMD [ "/app/scripts/run-dev.sh" ]
2025-02-24 23:43:55 +01:00
FROM python:${PYTHON_VERSION}-slim-${CODENAME} AS release
ARG UV_PROJECT_ENVIRONMENT
ENV UV_PROJECT_ENVIRONMENT=${UV_PROJECT_ENVIRONMENT}
2025-02-24 15:48:52 +01:00
ENV PATH=${UV_PROJECT_ENVIRONMENT}/bin:${PATH}
WORKDIR /app
COPY --chown=runner:runner ./ ./
2025-02-24 23:43:55 +01:00
COPY --from=deps --chown=runner:runner ${UV_PROJECT_ENVIRONMENT} ${UV_PROJECT_ENVIRONMENT}
2025-02-24 15:48:52 +01:00
CMD [ "/app/scripts/run.sh" ]