forked from go-swagger/go-swagger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
27 lines (18 loc) · 850 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
25
26
27
FROM golang:alpine
ARG commit_hash="dev"
ARG tag_name="dev"
ADD . /work
WORKDIR /work
RUN apk --no-cache add ca-certificates shared-mime-info mailcap git build-base
RUN mkdir -p bin &&\
LDFLAGS="-linkmode external -extldflags \"-static\"" &&\
LDFLAGS="$LDFLAGS -X github.com/go-swagger/go-swagger/cmd/swagger/commands.Commit=${commit_hash}" &&\
LDFLAGS="$LDFLAGS -X github.com/go-swagger/go-swagger/cmd/swagger/commands.Version=${tag_name}" &&\
go build -o bin/swagger -ldflags "$LDFLAGS" -a ./cmd/swagger
FROM golang:alpine
LABEL maintainer="Ivan Porto Carrero <[email protected]> (@casualjim)"
RUN apk --no-cache add ca-certificates shared-mime-info mailcap git build-base
COPY --from=0 /work/bin/swagger /usr/bin/swagger
COPY --from=0 /work/generator/templates/contrib /templates/
ENTRYPOINT ["/usr/bin/swagger"]
CMD ["--help"]