2626 IMAGE_NAME : mlsys-io/lumilake_server
2727
2828jobs :
29+ build-pr :
30+ name : Build image
31+ if : github.event_name == 'pull_request'
32+ runs-on : [self-hosted, docker]
33+ permissions :
34+ contents : read
35+ steps :
36+ - name : Checkout
37+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
38+ with :
39+ persist-credentials : false
40+
41+ - name : Set up Buildx
42+ uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
43+
44+ - name : Compute image tags
45+ id : tags
46+ env :
47+ SHA : ${{ github.sha }}
48+ run : |
49+ set -eu
50+ short_sha="${SHA::7}"
51+ echo "tags=${REGISTRY}/${IMAGE_NAME}:pr-${short_sha}" >> "$GITHUB_OUTPUT"
52+
53+ - name : Set up uv
54+ uses : astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
55+ with :
56+ version : " 0.11.8"
57+ python-version : " 3.12"
58+ # No uv cache restore in a publishing workflow (cache-poisoning).
59+ enable-cache : false
60+
61+ - name : Sync server requirements from uv.lock
62+ run : uv run --frozen scripts/dev/sync_requirements.py --write
63+
64+ - name : Verify lockfile sync was a no-op
65+ run : |
66+ if ! git diff --quiet src/lumilake_server/requirements.txt; then
67+ echo "src/lumilake_server/requirements.txt drifted from uv.lock." >&2
68+ echo "Run: uv run scripts/dev/sync_requirements.py --write" >&2
69+ git --no-pager diff src/lumilake_server/requirements.txt
70+ exit 1
71+ fi
72+
73+ - name : Build and push
74+ id : build
75+ uses : docker/build-push-action@1dc73863535b631f98b2378be8619f83b136f4a0 # v6.17.0
76+ with :
77+ context : .
78+ file : ./Dockerfile
79+ push : false
80+ tags : ${{ steps.tags.outputs.tags }}
81+ provenance : false
82+ build-args : |
83+ BUILD_VERSION=${{ github.ref_name }}
84+ BUILD_REF=${{ github.sha }}
85+ BUILD_CREATED=${{ github.event.repository.updated_at }}
86+
2987 build-and-push :
30- name : Build multi-arch image
88+ name : Build and push multi-arch image
89+ if : github.event_name == 'push'
3190 runs-on : [self-hosted, docker]
3291 permissions :
3392 contents : read
@@ -39,13 +98,12 @@ jobs:
3998 persist-credentials : false
4099
41100 - name : Set up QEMU
42- uses : docker/setup-qemu-action@5306bad0baa6b616b9934712d4b9bc20069df9bf # v3.6.0
101+ uses : docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
43102
44103 - name : Set up Buildx
45104 uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
46105
47106 - name : Log in to GHCR
48- if : github.event_name != 'pull_request'
49107 uses : docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
50108 with :
51109 registry : ${{ env.REGISTRY }}
@@ -58,18 +116,15 @@ jobs:
58116 REF_NAME : ${{ github.ref_name }}
59117 REF_TYPE : ${{ github.ref_type }}
60118 SHA : ${{ github.sha }}
61- EVENT_NAME : ${{ github.event_name }}
62119 run : |
63120 set -eu
64121 short_sha="${SHA::7}"
65122 tags=("${REGISTRY}/${IMAGE_NAME}:${short_sha}")
66123 # :latest is owned by release-images.yml (gated on env approval).
67- if [[ "${EVENT_NAME}" == "push" ]]; then
68- if [[ "${REF_TYPE}" == "tag" && "${REF_NAME}" == v* ]]; then
69- tags+=("${REGISTRY}/${IMAGE_NAME}:${REF_NAME}")
70- elif [[ "${REF_NAME}" == "main" ]]; then
71- tags+=("${REGISTRY}/${IMAGE_NAME}:dev")
72- fi
124+ if [[ "${REF_TYPE}" == "tag" && "${REF_NAME}" == v* ]]; then
125+ tags+=("${REGISTRY}/${IMAGE_NAME}:${REF_NAME}")
126+ elif [[ "${REF_NAME}" == "main" ]]; then
127+ tags+=("${REGISTRY}/${IMAGE_NAME}:dev")
73128 fi
74129 ( IFS=,; echo "tags=${tags[*]}" ) >> "$GITHUB_OUTPUT"
75130
@@ -100,7 +155,7 @@ jobs:
100155 context : .
101156 file : ./Dockerfile
102157 platforms : linux/amd64,linux/arm64
103- push : ${{ github.event_name != 'pull_request' }}
158+ push : true
104159 tags : ${{ steps.tags.outputs.tags }}
105160 provenance : false
106161 build-args : |
@@ -109,7 +164,6 @@ jobs:
109164 BUILD_CREATED=${{ github.event.repository.updated_at }}
110165
111166 - name : Smoke-test pushed image
112- if : github.event_name != 'pull_request'
113167 env :
114168 SHA : ${{ github.sha }}
115169 run : |
0 commit comments