File tree Expand file tree Collapse file tree 3 files changed +52
-22
lines changed Expand file tree Collapse file tree 3 files changed +52
-22
lines changed Original file line number Diff line number Diff line change @@ -72,23 +72,23 @@ brews:
7272 - name : git
7373 - name : go
7474
75- dockers :
76- - # GOOS of the built binary that should be used.
77- goos : linux
78- goarch : amd64
79-
80- # Name templates of the built binaries that should be used.
81- ids : ["cgapp"]
82-
83- # Templates of the Docker image names.
84- image_templates :
85- - " koddr/cgapp:{{ .Major }}.{{ .Minor }}.{{ .Patch }}"
86- - " koddr/cgapp:{{ .Major }}.{{ .Minor }}"
87- - " koddr/cgapp:{{ .Major }}"
88- - " koddr/cgapp:latest"
89-
90- # Path to the Dockerfile (from the project root).
91- dockerfile : Dockerfile
75+ # dockers:
76+ # - # GOOS of the built binary that should be used.
77+ # goos: linux
78+ # goarch: amd64
79+ #
80+ # # Name templates of the built binaries that should be used.
81+ # ids: ["cgapp"]
82+ #
83+ # # Templates of the Docker image names.
84+ # image_templates:
85+ # - "koddr/cgapp:{{ .Major }}.{{ .Minor }}.{{ .Patch }}"
86+ # - "koddr/cgapp:{{ .Major }}.{{ .Minor }}"
87+ # - "koddr/cgapp:{{ .Major }}"
88+ # - "koddr/cgapp:latest"
89+ #
90+ # # Path to the Dockerfile (from the project root).
91+ # dockerfile: Dockerfile.goreleaser
9292
9393archives :
9494 - # Replacements for GOOS and GOARCH in the archive name.
Original file line number Diff line number Diff line change 1- # Please DO NOT use it for build a normal Docker image for Create Go App CLI!
2- # This Dockerfile used ONLY with GoReleaser project (`task release [TAG...]`).
1+ # Use this file for build a normal Docker/Podman image for Create Go App CLI.
32
4- FROM alpine:edge
3+ FROM golang:1.17-alpine AS builder
54
65LABEL maintainer=
"Vic Shóstak <[email protected] >" 76
8- # Copy Create Go App CLI binary.
9- COPY cgapp /cgapp
7+ # Move to working directory (/build).
8+ WORKDIR /build
9+
10+ # Copy and download dependency using go mod.
11+ COPY go.mod go.sum ./
12+ RUN go mod download
13+
14+ # Copy the code into the container.
15+ COPY . .
16+
17+ # Set necessary environment variables needed for our image and build the Create Go App CLI
18+ ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64
19+ RUN go build -ldflags="-s -w" -o cgapp cmd/cgapp/main.go
20+
21+ FROM alpine:edge
22+
23+ # Copy binary and config files from /build to root folder of scratch container.
24+ COPY --from=builder ["/build/cgapp" , "/" ]
1025
1126# Install git, npm (with nodejs).
1227RUN apk add --no-cache git npm
Original file line number Diff line number Diff line change 1+ # Please DO NOT use it for build a normal Docker image for Create Go App CLI!
2+ # This Dockerfile used ONLY with GoReleaser project (`task release [TAG...]`).
3+
4+ FROM alpine:edge
5+
6+ LABEL maintainer="Vic Shóstak <
[email protected] >"
7+
8+ # Copy Create Go App CLI binary.
9+ COPY cgapp /cgapp
10+
11+ # Install git, npm (with nodejs).
12+ RUN apk add --no-cache git npm
13+
14+ # Set entry point.
15+ ENTRYPOINT ["/cgapp"]
You can’t perform that action at this time.
0 commit comments