From 52a9ea212afe8a56d73afb419633d40db15ccd7d Mon Sep 17 00:00:00 2001 From: CrazyBolillo Date: Sat, 13 Jul 2024 09:06:10 -0600 Subject: [PATCH] ci: add docker image 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. --- .dockerignore | 10 ++++++++++ .github/workflows/qa.yaml | 8 ++++++++ Dockerfile | 14 ++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..bf29d1e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +docs/ +dist/ +.github/ + +.dockerignore +.gitignore + +Makefile +README.md +LICENSE diff --git a/.github/workflows/qa.yaml b/.github/workflows/qa.yaml index 43d05e7..1bd2d9c 100644 --- a/.github/workflows/qa.yaml +++ b/.github/workflows/qa.yaml @@ -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..994eef3 --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file