Skip to content

Commit

Permalink
ci: add docker image
Browse files Browse the repository at this point in the history
A docker image will be uploaded to github's registry on new
releases, it is also built as part of the QA job to ensure no
regressions.
  • Loading branch information
crazybolillo committed Jul 25, 2024
1 parent ae8b52a commit e275804
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
docs/
dist/
.github/

.dockerignore
.gitignore

Makefile
README.md
LICENSE
8 changes: 8 additions & 0 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,11 @@ jobs:
run: sqlc vet
- name: Diff
run: sqlc diff
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/build-push-action@v5
with:
context: .
push: false
21 changes: 21 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,24 @@ jobs:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/crazybolillo/eryth
- uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM golang:1.22

WORKDIR /app

COPY . .

ENV CGO_ENABLED=0
RUN go build -o /bin/eryth ./cmd

FROM scratch

COPY --from=0 /bin/eryth /bin/eryth

ENTRYPOINT ["eryth"]

0 comments on commit e275804

Please sign in to comment.