This commit is contained in:
2025-09-20 10:09:41 -07:00
parent ee50d6d314
commit ecec0c659e

View File

@@ -7,7 +7,7 @@ on:
- main
paths:
- 'app.py'
- 'dockerfile'
- 'Dockerfile'
- 'requirements.txt'
- 'docker-compose.yml'
@@ -32,6 +32,24 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Create multi-arch Dockerfile
run: |
cat > Dockerfile <<EOF
FROM --platform=\$BUILDPLATFORM python:3.11-slim as builder
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
FROM python:3.11-slim
WORKDIR /app
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY . .
CMD ["python", "app.py"]
EOF
- name: Build and push multi-arch Docker image
uses: docker/build-push-action@v5
with:
@@ -42,4 +60,6 @@ jobs:
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha,mode=max
provenance: false
sbom: false