Skip to content

Commit 4a2da5f

Browse files
committed
Attempt Docker job
1 parent 81afa2c commit 4a2da5f

2 files changed

Lines changed: 52 additions & 3 deletions

File tree

.github/workflows/publish.yml

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
target: x86_64-pc-windows-msvc
2121

2222
steps:
23-
- uses: actions/checkout@v2
23+
- uses: actions/checkout@v4
2424

2525
- uses: actions-rs/toolchain@v1
2626
with:
@@ -45,5 +45,41 @@ jobs:
4545
with:
4646
repo_token: ${{ secrets.GITHUB_TOKEN }}
4747
file: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
48-
asset_name: ${{ matrix.asset_name }}
49-
tag: ${{ github.ref }}
48+
asset_name: ${{ matrix.artifact_name }}
49+
tag: ${{ github.ref }}
50+
51+
docker:
52+
name: Build and Push Docker Image
53+
runs-on: ubuntu-latest
54+
permissions:
55+
contents: read
56+
packages: write
57+
58+
steps:
59+
- name: Checkout repository
60+
uses: actions/checkout@v4
61+
62+
- name: Log in to the Container registry
63+
uses: docker/login-action@v3
64+
with:
65+
registry: ghcr.io
66+
username: ${{ github.actor }}
67+
password: ${{ secrets.GITHUB_TOKEN }}
68+
69+
- name: Extract metadata (tags, labels)
70+
id: meta
71+
uses: docker/metadata-action@v5
72+
with:
73+
images: ghcr.io/${{ github.repository }}
74+
tags: |
75+
type=semver,pattern={{version}}
76+
type=raw,value=latest,enable=${{ github.ref == format('refs/tags/{0}', github.event.repository.default_branch) }}
77+
type=sha
78+
79+
- name: Build and push Docker image
80+
uses: docker/build-push-action@v5
81+
with:
82+
context: .
83+
push: true
84+
tags: ${{ id.meta.outputs.tags }}
85+
labels: ${{ id.meta.outputs.labels }}

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Builder
2+
FROM rust:1-slim-bookworm as builder
3+
WORKDIR /app
4+
COPY . .
5+
RUN apt-get update && apt-get install -y pkg-config libssl-dev
6+
RUN cargo build --release
7+
8+
# Runtime
9+
FROM debian:bookworm-slim
10+
WORKDIR /app
11+
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
12+
COPY --from=builder /app/target/release/discord-compiler-bot /app/bot
13+
CMD ["./bot"]

0 commit comments

Comments
 (0)