Files
archived-teslamateapi/Dockerfile
dependabot[bot] 4008f9a7fd Bump golang from 1.16.2 to 1.16.3
Bumps golang from 1.16.2 to 1.16.3.

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-05 07:17:58 +00:00

37 lines
617 B
Docker

# get latest golang container
FROM golang:1.16.3
# create and set workingfolder
WORKDIR /go/src/
# copy go mod files
COPY go.mod go.sum ./
# download go mods
RUN go mod download
# copy all sourcecode
COPY src/ .
# compile the program
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o TeslaMateApi .
# get latest alpine container
FROM alpine:latest
# add ca-certificates
RUN apk --no-cache add ca-certificates tzdata
# create workdir
WORKDIR /root/
# copy binary from first container
COPY --from=0 /go/src/TeslaMateApi .
# expose port 8080
EXPOSE 8080
# run application
CMD ["./TeslaMateApi"]