File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
sample-docker-templates/go Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ # ################################ Build Container ###############################
2+
3+ FROM golang:1.16 as builder
4+
5+ # Setup the working directory
6+ WORKDIR /app
7+
8+ # Add source code
9+ ADD . /app/
10+
11+ # Build the source
12+ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main app.go
13+
14+
15+ # ################################ Prod Container #################################
16+
17+ # Use a minimal alpine image
18+ FROM alpine:3.7
19+
20+ # Add ca-certificates in case you need them
21+ RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
22+
23+ # Set working directory
24+ WORKDIR /root
25+
26+ # Copy the binary from builder
27+ COPY --from=builder /app/. .
28+
29+ # Run the binary
30+ CMD ["./main" ]
31+
32+
33+
34+
You can’t perform that action at this time.
0 commit comments