-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (25 loc) · 814 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
# Start the Go app build
FROM 817615305328.dkr.ecr.us-east-1.amazonaws.com/golang:latest AS build
# Copy source
WORKDIR /go/src/
# Copy the local package files to the container's workspace.
COPY /src/ /go/src/
WORKDIR /go/src/
# Get required modules (assumes packages have been added to ./vendor)
RUN go mod download
# Build a statically-linked Go binary for Linux
RUN CGO_ENABLED=0 GOOS=linux go build -a -o main .
# New build phase -- create binary-only image
FROM 817615305328.dkr.ecr.us-east-1.amazonaws.com/alpine:latest
# Add support for HTTPS
RUN apk update && \
apk upgrade && \
apk add ca-certificates
WORKDIR /
# Copy files from previous build container
COPY --from=build /go/src/main ./
# Check results
RUN env && pwd && find .
EXPOSE 8080
# Start the application
CMD ["./main"]