-
Notifications
You must be signed in to change notification settings - Fork 16
/
Dockerfile
24 lines (16 loc) · 705 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
24
FROM golang:1.21-alpine as build
WORKDIR /go/src/github.com/uselagoon/lagoon-cli/
COPY . .
ARG VERSION
RUN apk update && apk add git
RUN VERSION=${VERSION:-"$(echo $(git describe --abbrev=0 --tags)+$(git rev-parse --short=8 HEAD))"} \
&& BUILD=$(date +%FT%T%z) \
&& CGO_ENABLED=0 GOOS=linux go build \
-ldflags "-w -s -X github.com/uselagoon/lagoon-cli/cmd.lagoonCLIVersion=$VERSION \
-X github.com/uselagoon/lagoon-cli/cmd.lagoonCLIBuild=$BUILD \
-X github.com/uselagoon/lagoon-cli/cmd.lagoonCLIBuildGoVersion=go$GOLANG_VERSION" -o lagoon .
FROM alpine:3
WORKDIR /root/
COPY --from=build /go/src/github.com/uselagoon/lagoon-cli/lagoon /lagoon
RUN touch ~/.lagoon.yml
ENTRYPOINT ["/lagoon"]