goshorly/Dockerfile

21 lines
684 B
Text
Raw Normal View History

2021-12-07 18:10:53 +00:00
FROM golang:alpine as builder
2021-12-07 14:49:58 +00:00
2022-01-06 18:27:20 +00:00
RUN apk add --no-cache git make build-base
2022-01-06 19:03:57 +00:00
ENV CGO_ENABLED=0
2021-12-07 14:49:58 +00:00
2021-12-07 17:09:14 +00:00
WORKDIR /go/src/git.ucode.space/goshorly
2021-12-07 15:15:19 +00:00
COPY . .
2021-12-07 14:49:58 +00:00
2021-12-07 15:15:19 +00:00
RUN go get -d -v ./...
2022-01-06 17:53:02 +00:00
2022-01-06 17:57:39 +00:00
# RUN export I_PACKAGE="git.ucode.space/Phil/goshorly/utils" && \
# export I_GitCommitShort=$(git rev-parse --short HEAD) && \
# export I_GitBranch=$(git rev-parse --abbrev-ref HEAD) && \
# go build -a -installsuffix cgo -ldflags "-X $I_PACKAGE.GitCommitShort=$I_GitCommitShort -X $I_PACKAGE.GitBranch=$I_GitBranch" -o app .
2022-01-06 19:03:57 +00:00
RUN go build -a -installsuffix -ldflags="-w -s" -o app .
2021-12-07 17:09:14 +00:00
2021-12-07 18:10:53 +00:00
FROM scratch as production
2022-01-06 19:03:57 +00:00
WORKDIR /
COPY --from=builder /go/src/git.ucode.space/goshorly/app /app
ENTRYPOINT [ "/app" ]