Skip to content

Commit d7db5f2

Browse files
authored
Fix CD to run on push to main (#2)
* Fix CD to run on push to main * Changed base Python image from 3.13 to 3.12 * Modified Dockerfile - cleaned up too many spaces
1 parent fdc7798 commit d7db5f2

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

.github/workflows/ci_cd.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,30 @@ on:
44
pull_request:
55
branches:
66
- main
7+
push:
8+
branches:
9+
- main
710

811
jobs:
912
ci:
1013
runs-on: ubuntu-latest
1114
steps:
1215
- uses: actions/checkout@v4
13-
1416
- name: Build and Check (using multi-stage Dockerfile)
1517
run: make docker-check-ci
1618

1719
cd:
1820
needs: ci
19-
if: github.ref == 'refs/heads/main'
21+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
2022
runs-on: ubuntu-latest
2123
steps:
2224
- uses: actions/checkout@v4
23-
2425
- name: Build prod image
2526
run: make docker-build-prod
26-
2727
- name: Login to Docker Hub
2828
uses: docker/login-action@v3
2929
with:
3030
username: ${{ secrets.DOCKERHUB_USERNAME }}
3131
password: ${{ secrets.DOCKERHUB_TOKEN }}
32-
3332
- name: Push prod image
3433
run: make docker-push

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ------------------------------- Builder Satge -------------------------------
22

3-
# Build stage (with dev tools for linting, testing, etc.)
4-
FROM python:3.13-slim-bookworm AS builder
3+
# Build stage (with dev tools for linting, testing, etc.)
4+
FROM python:3.12-slim-bookworm AS builder
55

66
# The installer requires curl (and certificates) to download the release archive
77
RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && \
@@ -29,10 +29,11 @@ RUN uv sync
2929
# Copy the rest of the project
3030
COPY . /app
3131

32+
3233
# ------------------------- Production Stage -------------------------
3334

3435
# Final stage (production, lean image)
35-
FROM python:3.13-slim-bookworm AS production
36+
FROM python:3.12-slim-bookworm AS production
3637
WORKDIR /app
3738

3839
# Prevent Python from writing pyc files and buffering output

0 commit comments

Comments
 (0)