Skip to content

Commit 5244d3a

Browse files
committed
feat: build and push Docker image on release
- Add Dockerfile to build hf-mount-fuse container image - Add Docker build & push job to release workflow - Publish image as ghcr.io/huggingface/hf-mount-fuse:vX.Y.Z - Enables CSI driver to use pre-built image instead of building from source
1 parent 468d210 commit 5244d3a

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ on:
77

88
permissions:
99
contents: write
10+
packages: write
1011

1112
env:
1213
CARGO_TERM_COLOR: always
14+
REGISTRY: ghcr.io
15+
IMAGE: ghcr.io/huggingface/hf-mount-fuse
1316

1417
jobs:
1518
build-linux:
@@ -104,6 +107,38 @@ jobs:
104107
name: macos-${{ matrix.arch }}
105108
path: dist/
106109

110+
docker:
111+
name: Build & Push Docker
112+
runs-on: ubuntu-22.04
113+
steps:
114+
- uses: actions/checkout@v4
115+
116+
- uses: docker/login-action@v3
117+
with:
118+
registry: ${{ env.REGISTRY }}
119+
username: ${{ github.actor }}
120+
password: ${{ secrets.GITHUB_TOKEN }}
121+
122+
- name: Extract version
123+
id: version
124+
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
125+
126+
- name: Determine tags
127+
id: tags
128+
run: |
129+
TAG="${{ steps.version.outputs.tag }}"
130+
TAGS="${{ env.IMAGE }}:${TAG}"
131+
if [[ "$TAG" != *"-"* ]]; then
132+
TAGS="${TAGS},${{ env.IMAGE }}:latest"
133+
fi
134+
echo "tags=$TAGS" >> "$GITHUB_OUTPUT"
135+
136+
- uses: docker/build-push-action@v6
137+
with:
138+
context: .
139+
push: true
140+
tags: ${{ steps.tags.outputs.tags }}
141+
107142
release:
108143
name: Create Release
109144
needs: [build-linux, build-macos]

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Build hf-mount-fuse (Rust)
2+
FROM rust:1.89-bookworm AS builder
3+
WORKDIR /build
4+
COPY . .
5+
RUN cargo build --release --features fuse --bin hf-mount-fuse
6+
7+
# Runtime
8+
FROM debian:bookworm-slim
9+
RUN apt-get update && apt-get install -y --no-install-recommends libfuse3-3 ca-certificates && rm -rf /var/lib/apt/lists/*
10+
COPY --from=builder /build/target/release/hf-mount-fuse /usr/local/bin/
11+
ENTRYPOINT ["/usr/local/bin/hf-mount-fuse"]

0 commit comments

Comments
 (0)