mirror of
https://github.com/tobiasehlert/teslamateapi.git
synced 2026-02-27 09:54:18 +08:00
Bumps golang from 1.18.1 to 1.18.2. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
40 lines
677 B
Docker
40 lines
677 B
Docker
# get latest golang container
|
|
FROM golang:1.18.2
|
|
|
|
# get args
|
|
ARG apiVersion=unknown
|
|
|
|
# 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 -ldflags="-w -s -X 'main.apiVersion=${apiVersion}'" -o app .
|
|
|
|
|
|
# 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/app .
|
|
|
|
# expose port 8080
|
|
EXPOSE 8080
|
|
|
|
# run application
|
|
CMD ["./app"]
|