prod(docker): support BASE_IMAGE override for both stages; enable BuildKit pip cache; compose uses Dockerfile.production

This commit is contained in:
HotSwapp
2025-09-04 16:07:29 -05:00
parent e69f2fe700
commit a7a03f8369
2 changed files with 8 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
# syntax=docker/dockerfile:1.5
# Production Dockerfile for Delphi Consulting Group Database System # 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 # Set build arguments
ARG BUILD_DATE ARG BUILD_DATE
@@ -19,10 +21,12 @@ WORKDIR /app
# Copy requirements and install dependencies # Copy requirements and install dependencies
COPY requirements.txt . 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 # Production stage
FROM python:3.12-slim ARG BASE_IMAGE=python:3.12-slim
FROM ${BASE_IMAGE}
# Set labels # Set labels
LABEL maintainer="Delphi Consulting Group Inc." \ LABEL maintainer="Delphi Consulting Group Inc." \

View File

@@ -2,6 +2,7 @@ services:
delphi-db: delphi-db:
build: build:
context: . context: .
dockerfile: Dockerfile.production
args: args:
BASE_IMAGE: ${BASE_IMAGE:-python:3.12-slim} BASE_IMAGE: ${BASE_IMAGE:-python:3.12-slim}
container_name: delphi-database container_name: delphi-database