54 lines
1.4 KiB
Docker
54 lines
1.4 KiB
Docker
#################################################
|
|
FROM debian:bookworm-slim AS builder-base
|
|
|
|
RUN apt-get update && \
|
|
apt-get install --no-install-recommends -y \
|
|
libpq-dev \
|
|
ca-certificates \
|
|
&& groupadd --gid 1001 appuser \
|
|
&& useradd --uid 1001 --gid appuser --shell /bin/bash --create-home appuser
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
UV_VERSION="0.7.12" \
|
|
UV_PYTHON="3.13.4" \
|
|
UV_PYTHON_INSTALL_DIR="/app/.python" \
|
|
UV_PYTHON_PREFERENCE="only-managed" \
|
|
UV_COMPILE_BYTECODE=1 \
|
|
UV_NO_INSTALLER_METADATA=1 \
|
|
UV_LINK_MODE=copy \
|
|
PATH="$PATH:/root/.local/bin/:/app/.venv/bin"
|
|
#################################################
|
|
FROM builder-base AS python-base
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get install --no-install-recommends -y \
|
|
curl \
|
|
clang \
|
|
&& curl -LsSf https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-installer.sh | sh \
|
|
&& uv python install
|
|
|
|
COPY pyproject.toml ./
|
|
|
|
RUN uv sync --no-dev -n
|
|
RUN uv version --short > .version
|
|
#################################################
|
|
FROM builder-base AS production
|
|
|
|
WORKDIR /app
|
|
|
|
RUN chown -R appuser:appuser /app
|
|
|
|
COPY --from=python-base /app/.python /app/.python
|
|
COPY --from=python-base /app/.venv /app/.venv
|
|
COPY --from=python-base /app/.version /app/
|
|
COPY /src/ /app/
|
|
COPY /scripts/ /app/scripts
|
|
RUN chmod -R 755 /app/scripts
|
|
|
|
USER appuser
|
|
|
|
CMD ["sh", "./scripts/boot.sh"]
|
|
#################################################
|