-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (23 loc) · 767 Bytes
/
Dockerfile
File metadata and controls
33 lines (23 loc) · 767 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
33
FROM golang:alpine AS builder
# Set necessary environmet variables needed for our image
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
# Move to working directory /build
WORKDIR /build
# Copy the code into the container
COPY . .
# Build the application
RUN go build -o simple_http_server ./simple_http_server.go
# Move to /dist directory as the place for resulting binary folder
WORKDIR /dist
# Copy binary from build to main folder
RUN cp /build/simple_http_server .
EXPOSE 8000
# Build a small image
FROM alpine
RUN apk update && apk add curl
COPY --from=builder /dist/simple_http_server /
HEALTHCHECK --interval=5s --timeout=10s --retries=3 CMD curl -sS 127.0.0.1:8081/healthcheck || exit 1
ENTRYPOINT ["/simple_http_server"]