-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from NBISweden/fix/image
Use golang image instead of raw
- Loading branch information
Showing
1 changed file
with
3 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 |
---|---|---|
@@ -1,16 +1,13 @@ | ||
FROM golang:1.15.5-alpine3.12 | ||
RUN apk add --no-cache git | ||
RUN apk add --no-cache git coreutils && rm -rf /var/cache/apk/* | ||
COPY . . | ||
ENV GO111MODULE=on | ||
ENV GOPATH=$PWD | ||
ENV XDG_CACHE_HOME=/tmp/.cache | ||
ENV CGO_ENABLED=0 | ||
ENV GOOS=linux | ||
RUN go build -ldflags "-extldflags -static" -o ./build/svc . | ||
RUN go build -ldflags "-extldflags -static" -o svc . | ||
RUN echo "nobody:x:65534:65534:nobody:/:/sbin/nologin" > passwd | ||
|
||
FROM scratch | ||
COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --from=0 /go/build/svc svc | ||
COPY --from=0 /go/passwd /etc/passwd | ||
USER 65534 | ||
EXPOSE 8080 |