Skip to content

Commit

Permalink
feat: add docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
wvffle committed Oct 31, 2024
1 parent 76e9486 commit b1f064e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish Docker image

on:
push:
branches:
- master
workflow_dispatch:

jobs:
build-and-publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.sha }}
- name: Verify Docker image in GHCR
run: |
echo "Published image tags:"
docker pull ghcr.io/${{ github.repository }}:latest
docker pull ghcr.io/${{ github.repository }}:${{ github.sha }}
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM rust:latest AS builder
WORKDIR /usr/src/cracktorio-bot
COPY . .
RUN cargo build --release

FROM debian:buster-slim
COPY --from=builder /usr/src/cracktorio-bot/target/release/cracktorio-bot /usr/local/bin/cracktorio-bot
CMD ["cracktorio-bot"]

0 comments on commit b1f064e

Please sign in to comment.