forked from moremorefun/go-dc-wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
25 lines (24 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
############################
# STEP 1 build executable binary
############################
FROM golang:alpine as builder
RUN apk update && \
apk add --no-cache ca-certificates git
WORKDIR /src
COPY ./go.mod ./
RUN go mod download
COPY . ./
RUN CGO_ENABLED=0 go build -o app-cron ./cmd/crontab/main.go && \
CGO_ENABLED=0 go build -o app-api ./cmd/api/main.go && \
CGO_ENABLED=0 go build -o app-db ./cmd/db/main.go && \
CGO_ENABLED=0 go build -o app-dbinit ./cmd/dbinit/main.go && \
CGO_ENABLED=0 go build -o app-getaeskey ./cmd/getaeskey/main.go
############################
# STEP 2 build a small image
############################
FROM scratch
WORKDIR /app
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /src/init/* ./init/
COPY --from=builder /src/app-* ./
CMD ["./app-cron"]