-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
23 lines (20 loc) · 857 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
FROM registry.fedoraproject.org/fedora-minimal:37 as build
LABEL maintainer="Simon Krenger <[email protected]>"
LABEL description="A small container that returns the environment variables plus some basic information on port 8080"
WORKDIR /go/src/github.com/simonkrenger/echoenv
RUN microdnf install -y golang
COPY echoenv.go .
COPY go.mod .
RUN go get github.com/gin-gonic/gin
# http://blog.wrouesnel.com/articles/Totally%20static%20Go%20builds/
RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' .
FROM scratch
LABEL maintainer="Simon Krenger <[email protected]>"
LABEL description="A small container that returns the environment variables plus some basic information on port 8080"
WORKDIR /
COPY --from=0 /go/src/github.com/simonkrenger/echoenv/echoenv .
ENV GIN_MODE release
ENV PORT 8080
EXPOSE $PORT
USER 1001
CMD ["./echoenv"]