Skip to content

Commit

Permalink
Merge pull request #8 from caian-org/docker-image-build-improvements
Browse files Browse the repository at this point in the history
Fix a couple of lint (hadolint) issues
  • Loading branch information
upsetbit authored Apr 13, 2022
2 parents 1a8c403 + d6ddd45 commit 66db52c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM golang:1.18.1-alpine3.15 AS image

FROM image AS base
WORKDIR app
WORKDIR /go/app
COPY go.mod .
COPY go.sum .
RUN go mod download
@@ -10,14 +10,15 @@ RUN go list -m all \
| cut -f 1 -d " " \
| awk 'NF{print $0 "/..."}' \
| CGO_ENABLED=0 GOOS=linux xargs -n1 \
go build -v -installsuffix cgo -i; echo done
go build -v -installsuffix cgo -i; echo "done"

FROM base AS build
WORKDIR /go/app
COPY . .
RUN CGO_ENABLED=0 \
GOOS=linux \
go build -v -installsuffix cgo -o list-github-stars -ldflags "-s -w"

FROM alpine:3.15 as runtime
FROM alpine:3.15.4 as runtime
COPY --from=build /go/app/list-github-stars /usr/local/bin
ENTRYPOINT ["list-github-stars"]

0 comments on commit 66db52c

Please sign in to comment.