From a7a03f836992b6388d21cd8d67d92766e7b6d590 Mon Sep 17 00:00:00 2001 From: HotSwapp <47397945+HotSwapp@users.noreply.github.com> Date: Thu, 4 Sep 2025 16:07:29 -0500 Subject: [PATCH] prod(docker): support BASE_IMAGE override for both stages; enable BuildKit pip cache; compose uses Dockerfile.production --- Dockerfile.production | 10 +++++++--- docker-compose.yml | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile.production b/Dockerfile.production index 10deada..71858e4 100644 --- a/Dockerfile.production +++ b/Dockerfile.production @@ -1,5 +1,7 @@ +# syntax=docker/dockerfile:1.5 # Production Dockerfile for Delphi Consulting Group Database System -FROM python:3.12-slim as builder +ARG BASE_IMAGE=python:3.12-slim +FROM ${BASE_IMAGE} as builder # Set build arguments ARG BUILD_DATE @@ -19,10 +21,12 @@ WORKDIR /app # Copy requirements and install dependencies COPY requirements.txt . -RUN pip install --no-cache-dir --user -r requirements.txt +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install --user -r requirements.txt # Production stage -FROM python:3.12-slim +ARG BASE_IMAGE=python:3.12-slim +FROM ${BASE_IMAGE} # Set labels LABEL maintainer="Delphi Consulting Group Inc." \ diff --git a/docker-compose.yml b/docker-compose.yml index 618fca6..292cca3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,6 +2,7 @@ services: delphi-db: build: context: . + dockerfile: Dockerfile.production args: BASE_IMAGE: ${BASE_IMAGE:-python:3.12-slim} container_name: delphi-database