-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (29 loc) · 860 Bytes
/
Dockerfile
File metadata and controls
32 lines (29 loc) · 860 Bytes
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
############################
# STEP 1 build base
############################
FROM golang:1.19-alpine3.17 as build-base
RUN apk add --update --no-cache git ca-certificates build-base
WORKDIR /build
ENV GO111MODULE=on
COPY go.mod .
COPY go.sum .
RUN go mod download -x
############################
# STEP 2 image base
############################
FROM alpine:3.17 as image-base
WORKDIR /app
COPY --from=build-base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["/app/parrot", "serve"]
############################
# STEP 3 build executable
############################
FROM build-base AS builder
COPY . .
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o /build/bin/parrot main.go
############################
# STEP 4 Finalize image
############################
FROM image-base
COPY LICENSE .
COPY --from=builder /build/bin/parrot parrot