Skip to content

Commit

Permalink
build(deployments): update dockerfile to use scratch image
Browse files Browse the repository at this point in the history
  • Loading branch information
fyvri committed Dec 18, 2024
1 parent fbc984a commit 88782ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
29 changes: 4 additions & 25 deletions deployments/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
FROM golang:1.23-alpine AS builder

WORKDIR /app

# copy and download all necessary modules
COPY go.mod .
COPY go.sum .

RUN go mod download

# copy all local files to Image
COPY . .

# build Docker Image with CGO Enabled
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o go-qris ./cmd

FROM alpine:latest

WORKDIR /app

# get Executable Binary file to new Image
COPY --from=builder /app/go-qris ./

# run the server executable
CMD ["./go-qris"]
FROM scratch
COPY go-qris /go-qris
EXPOSE 1337
ENTRYPOINT ["/go-qris","run"]
1 change: 0 additions & 1 deletion deployments/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ dockers:
dockerfile: ./deployments/Dockerfile
build_flag_templates:
- "--platform=linux/amd64"

- image_templates:
- "docker.io/{{ .Env.DOCKERHUB_USERNAME }}/{{ .Env.DOCKERHUB_REPOSITORY }}:{{ .Tag }}-arm64"
- "docker.io/{{ .Env.DOCKERHUB_USERNAME }}/{{ .Env.DOCKERHUB_REPOSITORY }}:latest"
Expand Down

0 comments on commit 88782ae

Please sign in to comment.