Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Docker Build Image & publish to GHCR
on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- '.github/workflows/publish-image.yml'
jobs:
build-and-push:
runs-on: ubuntu-24.04-arm
steps:
- name: Check out repository
uses: actions/checkout@v4

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

- name: Format repo slug
uses: actions/github-script@v4
id: repo_slug
with:
result-encoding: string
script: return `ghcr.io/${context.repo.owner.toLowerCase()}/${context.repo.repo.toLowerCase()}`

- name: Echo repository slug
run: |
echo "Repository slug: ${{ steps.repo_slug.outputs.result }}"

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
push: true
tags: ${{ steps.repo_slug.outputs.result }}:latest
20 changes: 20 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM golang:1.24-alpine AS builder

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download

COPY . .

RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o lumos-discord-bot .

FROM alpine:latest

RUN apk add --no-cache ca-certificates

WORKDIR /app

COPY --from=builder /app/lumos-discord-bot .

ENTRYPOINT ["./lumos-discord-bot"]