Skip to content

Commit 70fbae3

Browse files
committed
release: publish dev images to a separate package
1 parent d44a2c1 commit 70fbae3

3 files changed

Lines changed: 93 additions & 14 deletions

File tree

.github/workflows/release.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@ permissions:
1616

1717
env:
1818
PYTHON_VERSION: "3.11"
19-
REGISTRY_IMAGE: ghcr.io/usnavy13/librecodeinterpreter
19+
REGISTRY_IMAGE_MAIN: ghcr.io/usnavy13/librecodeinterpreter
20+
REGISTRY_IMAGE_DEV: ghcr.io/usnavy13/librecodeinterpreter-dev
2021

2122
jobs:
2223
prepare:
2324
runs-on: ubuntu-latest
2425
outputs:
26+
registry_image: ${{ steps.tags.outputs.registry_image }}
2527
sha_tag: ${{ steps.tags.outputs.sha_tag }}
2628
moving_tag: ${{ steps.tags.outputs.moving_tag }}
29+
publish_latest: ${{ steps.tags.outputs.publish_latest }}
2730
version_tag: ${{ steps.tags.outputs.version_tag }}
2831
steps:
2932
- uses: actions/checkout@v4
@@ -33,11 +36,21 @@ jobs:
3336
echo "sha_tag=sha-${GITHUB_SHA}" >> "${GITHUB_OUTPUT}"
3437
3538
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
39+
echo "registry_image=${REGISTRY_IMAGE_MAIN}" >> "${GITHUB_OUTPUT}"
3640
echo "moving_tag=main" >> "${GITHUB_OUTPUT}"
41+
echo "publish_latest=true" >> "${GITHUB_OUTPUT}"
3742
elif [[ "${GITHUB_REF}" == "refs/heads/dev" ]]; then
43+
echo "registry_image=${REGISTRY_IMAGE_DEV}" >> "${GITHUB_OUTPUT}"
3844
echo "moving_tag=dev" >> "${GITHUB_OUTPUT}"
45+
echo "publish_latest=true" >> "${GITHUB_OUTPUT}"
46+
elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then
47+
echo "registry_image=${REGISTRY_IMAGE_MAIN}" >> "${GITHUB_OUTPUT}"
48+
echo "moving_tag=" >> "${GITHUB_OUTPUT}"
49+
echo "publish_latest=false" >> "${GITHUB_OUTPUT}"
3950
else
51+
echo "registry_image=${REGISTRY_IMAGE_MAIN}" >> "${GITHUB_OUTPUT}"
4052
echo "moving_tag=" >> "${GITHUB_OUTPUT}"
53+
echo "publish_latest=false" >> "${GITHUB_OUTPUT}"
4154
fi
4255
4356
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
@@ -78,7 +91,7 @@ jobs:
7891
push: true
7992
platforms: ${{ matrix.platform }}
8093
provenance: false
81-
tags: ${{ env.REGISTRY_IMAGE }}:${{ github.sha }}-${{ matrix.arch }}
94+
tags: ${{ needs.prepare.outputs.registry_image }}:${{ github.sha }}-${{ matrix.arch }}
8295
cache-from: type=gha,scope=release-app-${{ matrix.arch }}
8396
cache-to: type=gha,scope=release-app-${{ matrix.arch }},mode=max
8497

@@ -115,11 +128,11 @@ jobs:
115128
pip install pytest pytest-asyncio pytest-cov pytest-mock
116129
117130
- name: Pull release candidate
118-
run: docker pull "${REGISTRY_IMAGE}:${GITHUB_SHA}-${{ matrix.arch }}"
131+
run: docker pull "${{ needs.prepare.outputs.registry_image }}:${GITHUB_SHA}-${{ matrix.arch }}"
119132

120133
- name: Start smoke stack
121134
env:
122-
API_IMAGE: ${{ env.REGISTRY_IMAGE }}:${{ github.sha }}-${{ matrix.arch }}
135+
API_IMAGE: ${{ needs.prepare.outputs.registry_image }}:${{ github.sha }}-${{ matrix.arch }}
123136
run: |
124137
cp .env.example .env
125138
docker compose up -d
@@ -178,18 +191,22 @@ jobs:
178191
- name: Publish multi-arch manifest tags
179192
run: |
180193
tags=(
181-
"-t" "${REGISTRY_IMAGE}:${{ needs.prepare.outputs.sha_tag }}"
194+
"-t" "${{ needs.prepare.outputs.registry_image }}:${{ needs.prepare.outputs.sha_tag }}"
182195
)
183196
184197
if [[ -n "${{ needs.prepare.outputs.moving_tag }}" ]]; then
185-
tags+=("-t" "${REGISTRY_IMAGE}:${{ needs.prepare.outputs.moving_tag }}")
198+
tags+=("-t" "${{ needs.prepare.outputs.registry_image }}:${{ needs.prepare.outputs.moving_tag }}")
199+
fi
200+
201+
if [[ "${{ needs.prepare.outputs.publish_latest }}" == "true" ]]; then
202+
tags+=("-t" "${{ needs.prepare.outputs.registry_image }}:latest")
186203
fi
187204
188205
if [[ -n "${{ needs.prepare.outputs.version_tag }}" ]]; then
189-
tags+=("-t" "${REGISTRY_IMAGE}:${{ needs.prepare.outputs.version_tag }}")
206+
tags+=("-t" "${{ needs.prepare.outputs.registry_image }}:${{ needs.prepare.outputs.version_tag }}")
190207
fi
191208
192209
docker buildx imagetools create \
193210
"${tags[@]}" \
194-
"${REGISTRY_IMAGE}:${GITHUB_SHA}-amd64" \
195-
"${REGISTRY_IMAGE}:${GITHUB_SHA}-arm64"
211+
"${{ needs.prepare.outputs.registry_image }}:${GITHUB_SHA}-amd64" \
212+
"${{ needs.prepare.outputs.registry_image }}:${GITHUB_SHA}-arm64"

README.md

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,49 @@ docker compose -f docker-compose.prod.yml pull
6363
docker compose -f docker-compose.prod.yml up -d
6464
```
6565

66+
### Published Image Channels
67+
68+
The project now publishes two app-image channels:
69+
70+
- `ghcr.io/usnavy13/librecodeinterpreter`
71+
- stable branch tags: `main`, `latest`
72+
- immutable build tags: `sha-<commit>`, release tags like `v1.2.3`
73+
- `ghcr.io/usnavy13/librecodeinterpreter-dev`
74+
- development branch tags: `dev`, `latest`
75+
- immutable build tags: `sha-<commit>`
76+
77+
`docker-compose.prod.yml` stays pinned to the stable package by default:
78+
79+
```yaml
80+
image: ghcr.io/usnavy13/librecodeinterpreter:main
81+
```
82+
83+
### Use A Local Override File
84+
85+
If you want to pull the current `dev` image or build from your working tree without changing tracked compose files:
86+
87+
1. Copy the example override:
88+
89+
```bash
90+
cp docker-compose.override.example.yml docker-compose.override.yml
91+
```
92+
93+
2. Use it with the production compose stack:
94+
95+
```bash
96+
docker compose -f docker-compose.prod.yml -f docker-compose.override.yml pull
97+
docker compose -f docker-compose.prod.yml -f docker-compose.override.yml up -d
98+
```
99+
100+
The checked-in example defaults to `ghcr.io/usnavy13/librecodeinterpreter-dev:latest`.
101+
If you want to build from your local checkout instead, edit `docker-compose.override.yml`
102+
and switch to the commented `build:` block in the example. In that case, skip the
103+
`pull` step and run:
104+
105+
```bash
106+
docker compose -f docker-compose.prod.yml -f docker-compose.override.yml up --build -d
107+
```
108+
66109
## Build From Source
67110

68111
If you are developing locally or need to customize the image, use the source-backed workflow instead:
@@ -72,7 +115,7 @@ docker build --target app -t code-interpreter:nsjail .
72115
docker compose up -d
73116
```
74117

75-
The Dockerfile is split into `runtime-core`, `runtime-r`, and `app` targets so CI can reuse published runtime layers and avoid rebuilding the heavyweight R stage on every app change.
118+
The Dockerfile keeps `runtime-core` and `runtime-r` as internal build stages, but only the unified `app` image is published for deployment.
76119

77120
## Admin Dashboard
78121

@@ -164,14 +207,13 @@ For comprehensive testing details, see [TESTING.md](docs/TESTING.md).
164207

165208
## CI/CD
166209

167-
GitHub Actions is split into four workflows:
210+
GitHub Actions is split into three workflows:
168211

169212
- `ci.yml`: PR validation and required checks
170-
- `runtime.yml`: publish `runtime-core` and `runtime-r` cacheable base images
171213
- `release.yml`: publish multi-arch app images for `main`, `dev`, and release tags
172-
- `nightly.yml`: rebuild heavy runtime layers and run slow/full live validation
214+
- `nightly.yml`: build the app image locally and run slow/full live validation
173215

174-
Published images now use native `amd64` and `arm64` builds instead of a single emulated multi-arch build, and the app image can reuse the previously published `runtime-r` layer when runtime inputs have not changed.
216+
Published images use native `amd64` and `arm64` builds and are exposed as separate stable and dev GHCR packages.
175217

176218
## Security
177219

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copy this file to `docker-compose.override.yml` to customize how the API image
2+
# is sourced when running `docker compose -f docker-compose.prod.yml up -d`.
3+
#
4+
# `docker-compose.override.yml` is ignored by git so you can keep a local choice
5+
# without committing it.
6+
#
7+
# Default example: pull the latest dev image package.
8+
# To build from your local checkout instead, comment the `image`/`pull_policy`
9+
# lines below and uncomment the `build` block.
10+
11+
services:
12+
api:
13+
image: ghcr.io/usnavy13/librecodeinterpreter-dev:latest
14+
pull_policy: always
15+
16+
# build:
17+
# context: .
18+
# target: app
19+
# image: code-interpreter:nsjail
20+
# pull_policy: never

0 commit comments

Comments
 (0)