forked from muonsoft/openapi-mock
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
38 lines (28 loc) · 887 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
28
29
30
31
32
33
34
35
36
37
38
# build stage
FROM golang:alpine AS build-env
ARG APP_VERSION=""
ARG BUILD_TIME=""
ADD . /project
RUN set -e \
&& apk add --no-cache --update \
git \
bash \
&& set -x \
&& adduser -D -g '' openapi \
&& go version \
&& cd /project \
&& go mod download \
&& cd /project/cmd/openapi-mock \
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s -X main.version=${APP_VERSION} -X main.buildTime=${BUILD_TIME}" -o openapi-mock \
&& ls -la | grep "openapi-mock"
# final stage
FROM alpine
LABEL "homepage"="https://github.com/muonsoft/openapi-mock"
LABEL "maintainer"="Igor Lazarev <[email protected]>"
WORKDIR "/app"
COPY --from=build-env /etc/passwd /etc/passwd
COPY --from=build-env /project/cmd/openapi-mock/openapi-mock /app/openapi-mock
USER openapi
EXPOSE 8080
ENTRYPOINT [ "/app/openapi-mock" ]
CMD ["serve"]