-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Dockerfile to make build more cacheable (#50)
* Refactor Dockerfile to make build more cacheable * Try an edit
- Loading branch information
Showing
6 changed files
with
15 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
k8s-ecr-login-renew | ||
k8s-ecr-login-renew.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.vs | ||
.idea | ||
k8s-ecr-login-renew.exe | ||
k8s-ecr-login-renew.* | ||
k8s-ecr-login-renew | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM golang:1.20-alpine AS build | ||
WORKDIR /go/src/app | ||
ADD . /go/src/app | ||
RUN go get -d -v ./... | ||
COPY go.mod /go/src/app/ | ||
COPY go.sum /go/src/app/ | ||
RUN go mod download | ||
|
||
COPY . . | ||
RUN go build -o /go/bin/app | ||
|
||
FROM alpine:3.17 | ||
RUN addgroup -S -g 1001 appgroup && adduser -S -u 1001 -G appgroup appuser | ||
USER appuser | ||
|
||
COPY --from=build /go/bin/app /k8s-ecr-login-renew | ||
CMD ["/k8s-ecr-login-renew"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters