From 56f214e4034dca23aaa524abfc71ee23b02f3a00 Mon Sep 17 00:00:00 2001 From: kagchi Date: Tue, 17 Oct 2023 20:02:55 +0700 Subject: [PATCH] feat: add docker build --- .github/workflows/docker.yml | 18 ++++++++++++++++++ Dockerfile | 23 +++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 .github/workflows/docker.yml create mode 100644 Dockerfile diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..adbe3bc --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,18 @@ +name: Build & Push to container registry + +on: + release: + types: [created] + push: + branches: + - main + pull_request: + branches: + - "**" + paths: + - "Dockerfile" + +jobs: + docker: + uses: nezuchan/workflows/.github/workflows/docker-build.yml@main + secrets: inherit \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3f4758b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM golang:1.21-alpine as build-stage + +WORKDIR /tmp/build + +COPY . . + +# Build the project +RUN go build . + +FROM alpine:3 + +LABEL name "Invoice Creator" +LABEL maintainer "KagChi" + +WORKDIR /app + +# Install needed deps +RUN apk add --no-cache tini + +COPY --from=build-stage /tmp/build/invoice-creator main + +ENTRYPOINT ["tini", "--"] +CMD ["/app/main"] \ No newline at end of file