Skip to content

Commit ef0bdeb

Browse files
committed
ci: update docker workflow
1 parent 3f6f152 commit ef0bdeb

2 files changed

Lines changed: 15 additions & 95 deletions

File tree

.github/workflows/docker-ghcr.yml

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

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

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

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

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

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 }}
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/*
2918

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
19+
COPY --from=builder /app/target/release/itsxrust /usr/local/bin/itsxrust
3920

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 }}
21+
ENTRYPOINT ["itsxrust"]
22+
CMD ["--help"]

0 commit comments

Comments
 (0)