forked from devtron-labs/sample-go-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (22 loc) · 748 Bytes
/
Dockerfile
File metadata and controls
35 lines (22 loc) · 748 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
################################# Build Container ###############################
FROM golang:1.16 as builder
# Setup the working directory
WORKDIR /app
# Add source code
ADD . /app/
# Build the source
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main app.go
################################# Prod Container #################################
# Use a minimal alpine image
FROM alpine:3.7
#RUN apt update
#RUN apt install python
# Add ca-certificates in case you need them
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* && apk add python
# Set working directory
WORKDIR /root
COPY hello.py /root/hello.py
# Copy the binary from builder
COPY --from=builder /app/. .
# Run the binary
CMD ["./main"]