Skip to content

Commit b79ad7e

Browse files
committed
Address PR comments
1 parent e6eef6f commit b79ad7e

File tree

3 files changed

+35
-20
lines changed

3 files changed

+35
-20
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*
22
!docker-entrypoint.sh
3+
!artifact/

.github/workflows/release.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,28 @@ jobs:
195195

196196
docker:
197197
name: Build and Push Docker Image
198-
needs: create-release
198+
needs: build
199199
runs-on: ubuntu-latest
200200
if: startsWith(github.ref, 'refs/tags/')
201201

202202
steps:
203203
- name: Checkout code
204204
uses: actions/checkout@v4
205205

206-
- name: Extract version from tag
207-
id: version
208-
run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
206+
- name: Extract version and image name
207+
id: meta
208+
run: |
209+
echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
210+
echo "image=ghcr.io/${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
211+
212+
- name: Download Linux musl artifact
213+
uses: actions/download-artifact@v4
214+
with:
215+
name: torc-x86_64-unknown-linux-musl
216+
path: artifact
217+
218+
- name: Extract binaries for Docker build
219+
run: tar xzf artifact/torc-x86_64-unknown-linux-musl.tar.gz -C artifact/
209220

210221
- name: Log in to GitHub Container Registry
211222
uses: docker/login-action@v3
@@ -219,7 +230,7 @@ jobs:
219230
with:
220231
context: .
221232
push: true
222-
build-args: VERSION=${{ steps.version.outputs.version }}
233+
build-args: VERSION=${{ steps.meta.outputs.version }}
223234
tags: |
224-
ghcr.io/natlabrockies/torc:${{ steps.version.outputs.version }}
225-
ghcr.io/natlabrockies/torc:latest
235+
${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.version }}
236+
${{ steps.meta.outputs.image }}:latest

Dockerfile

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
# Usage:
2-
# # Build
3-
# docker build --build-arg VERSION=0.14.0 -t ghcr.io/natlabrockies/torc:0.14.0 .
2+
# # Download and extract release binaries
3+
# VERSION=0.14.0
4+
# mkdir -p artifact
5+
# curl -fsSL "https://github.com/NatLabRockies/torc/releases/download/v${VERSION}/torc-x86_64-unknown-linux-musl.tar.gz" \
6+
# | tar xz -C artifact/
47
#
5-
# # Push to GitHub Container Registry
6-
# echo $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdin
7-
# docker push ghcr.io/natlabrockies/torc:0.14.0
8+
# # Build
9+
# docker build --build-arg VERSION=$VERSION -t ghcr.io/natlabrockies/torc:$VERSION .
810
#
911
# # Run with required env vars
1012
# docker run -d -p 8080:8080 \
1113
# -e TORC_AUTH_FILE=/data/htpasswd \
1214
# -e TORC_ADMIN_USERS=admin \
1315
# -v ./htpasswd:/data/htpasswd:ro \
1416
# -v torc-data:/data \
15-
# ghcr.io/natlabrockies/torc:0.14.0
17+
# ghcr.io/natlabrockies/torc:$VERSION
1618
#
1719
# # Run torc CLI
18-
# docker run --rm ghcr.io/natlabrockies/torc:0.14.0 torc --version
20+
# docker run --rm ghcr.io/natlabrockies/torc:$VERSION torc --version
1921

2022
FROM alpine:3.23
2123

@@ -29,12 +31,13 @@ LABEL org.opencontainers.image.title="torc" \
2931
org.opencontainers.image.version="${VERSION}" \
3032
org.opencontainers.image.licenses="BSD-3-Clause"
3133

32-
# Download release binaries and remove curl afterward to keep image small
33-
# This is going to use pixi as soon as images are stored on conda-forge.
34-
RUN apk add --no-cache ca-certificates curl sqlite tmux && \
35-
curl -fsSL "https://github.com/NatLabRockies/torc/releases/download/v${VERSION}/torc-x86_64-unknown-linux-musl.tar.gz" \
36-
| tar xz -C /usr/local/bin/ && \
37-
apk del curl
34+
# Install runtime dependencies
35+
RUN apk add --no-cache ca-certificates sqlite tmux
36+
37+
# Copy pre-extracted release binaries from the build context
38+
COPY artifact/torc artifact/torc-server artifact/torc-slurm-job-runner \
39+
artifact/torc-dash artifact/torc-htpasswd artifact/torc-mcp-server \
40+
/usr/local/bin/
3841

3942
# Create data directory with OpenShift-compatible permissions.
4043
# OpenShift runs containers as arbitrary non-root UIDs but always in group 0 (root).

0 commit comments

Comments
 (0)