Skip to content

Commit b1f064e

Browse files
committed
feat: add docker image
1 parent 76e9486 commit b1f064e

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

.github/workflows/publish-docker.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-and-publish:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v2
19+
20+
- name: Log in to GitHub Container Registry
21+
uses: docker/login-action@v2
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Build and push Docker image
28+
uses: docker/build-push-action@v5
29+
with:
30+
context: .
31+
file: ./Dockerfile
32+
push: true
33+
tags: |
34+
ghcr.io/${{ github.repository }}:latest
35+
ghcr.io/${{ github.repository }}:${{ github.sha }}
36+
37+
- name: Verify Docker image in GHCR
38+
run: |
39+
echo "Published image tags:"
40+
docker pull ghcr.io/${{ github.repository }}:latest
41+
docker pull ghcr.io/${{ github.repository }}:${{ github.sha }}

Dockerfile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM rust:latest AS builder
2+
WORKDIR /usr/src/cracktorio-bot
3+
COPY . .
4+
RUN cargo build --release
5+
6+
FROM debian:buster-slim
7+
COPY --from=builder /usr/src/cracktorio-bot/target/release/cracktorio-bot /usr/local/bin/cracktorio-bot
8+
CMD ["cracktorio-bot"]

0 commit comments

Comments
 (0)