goshorly/Dockerfile

26 lines
721 B
Docker
Raw Permalink 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-09 14:14:19 +00:00
ARG CI_COMMIT_BRANCH
ARG CI_COMMIT_SHORT_SHA
ARG CI_COMMIT_TAG
2022-01-09 14:14:19 +00:00
ENV CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH
ENV CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA
ENV CI_COMMIT_TAG=$CI_COMMIT_TAG
2022-01-09 14:14:19 +00:00
2023-09-04 18:59:51 +00:00
ENV I_PACKAGE="git.hackmi.ch/Phil/goshorly/utils"
2022-01-06 19:03:57 +00:00
ENV CGO_ENABLED=0
2021-12-07 14:49:58 +00:00
2023-09-04 18:59:51 +00:00
WORKDIR /go/src/git.hackmi.ch/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
RUN go build -a -installsuffix cgo -ldflags=" -X $I_PACKAGE.CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -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 /
2023-09-04 18:59:51 +00:00
COPY --from=builder /go/src/git.hackmi.ch/goshorly/app /app
2022-12-23 21:58:45 +00:00
ENTRYPOINT [ "/app" ]