Skip to content

Commit 4ce89ee

Browse files
committed
fix: correct docker-publish workflow (was Dockerfile content)
1 parent ef0bdeb commit 4ce89ee

1 file changed

Lines changed: 39 additions & 15 deletions

File tree

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,46 @@
1-
# -------- builder --------
2-
FROM rust:1-bookworm AS builder
1+
name: Build and Push Docker Image
32

4-
WORKDIR /app
3+
on:
4+
push:
5+
tags:
6+
- "v*"
57

6-
COPY Cargo.toml Cargo.lock ./
7-
COPY src ./src
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
811

9-
RUN cargo build --release --locked
12+
jobs:
13+
docker:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
1018

11-
# -------- runtime --------
12-
FROM debian:bookworm-slim AS runtime
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
1322

14-
RUN apt-get update -y \
15-
&& apt-get install -y --no-install-recommends --fix-missing hmmer ca-certificates \
16-
&& apt-get clean \
17-
&& rm -rf /var/lib/apt/lists/*
23+
- name: Log in to GitHub Container Registry
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ${{ env.REGISTRY }}
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
1829

19-
COPY --from=builder /app/target/release/itsxrust /usr/local/bin/itsxrust
30+
- name: Extract metadata (tags, labels)
31+
id: meta
32+
uses: docker/metadata-action@v5
33+
with:
34+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
35+
tags: |
36+
type=semver,pattern={{version}}
37+
type=semver,pattern={{major}}.{{minor}}
38+
type=raw,value=latest
2039
21-
ENTRYPOINT ["itsxrust"]
22-
CMD ["--help"]
40+
- name: Build and push Docker image
41+
uses: docker/build-push-action@v6
42+
with:
43+
context: .
44+
push: true
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)