forked from lf-edge/adam
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
38 lines (28 loc) · 873 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
# Copyright (c) 2019 Zededa, Inc.
# SPDX-License-Identifier: Apache-2.0
FROM lfedge/eve-alpine:8.11.0 AS build
ENV BUILD_PKGS go git
RUN eve-alpine-deploy.sh
ENV CGO_ENABLED=0
ENV GO111MODULE=on
RUN mkdir -p /adam/src && mkdir -p /adam/bin
WORKDIR /adam/src
RUN go install github.com/go-swagger/go-swagger/cmd/swagger@v0.27.0
COPY go.mod .
COPY go.sum .
RUN go mod download
# these have to be last steps so they do not bust the cache with each change
COPY . /adam/src
ARG GOOS=linux
# ARG GOARCH=amd64
RUN go build -o /out/bin/adam main.go
COPY scripts/ /out/bin/
COPY samples/ /out/adam/
RUN mkdir /adam/swaggerui
RUN /root/go/bin/swagger generate spec -o /adam/swaggerui/swagger.json
FROM scratch
COPY --from=build /out/ /
ADD swaggerui ./swaggerui/
COPY --from=build /adam/swaggerui/swagger.json ./swaggerui/swagger.json
WORKDIR /adam
ENTRYPOINT ["/bin/adam"]