-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
44 lines (33 loc) · 1.38 KB
/
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
38
39
40
41
42
43
####################################################################
# Builder Stage #
####################################################################
# Start from a Debian image with the latest version of Go installed
# and a workspace (GOPATH) configured at /go.
FROM golang:alpine AS builder
LABEL MAINTAINER="georgetheprogrammer@gmail.com"
# Create WORKDIR using project's root directory
WORKDIR /go/src/github.com/ong-gtp/play-service
# Copy the local package files to the container's workspace
# in the above created WORKDIR
COPY . .
RUN go get github.com/gorilla/mux
RUN go get github.com/go-kit/kit
RUN go get github.com/go-kit/log
RUN go mod tidy
# Build the API service inside the container
RUN go build -o playsv
#####################################################################
# Final Stage #
#####################################################################
# Pull golang alpine image (very small image, with minimum needed to run Go)
FROM alpine:3.16
RUN apk update \
&& apk upgrade
# Create WORKDIR
WORKDIR /app
# Copy app binary from the Builder stage image
COPY --from=builder /go/src/github.com/ong-gtp/play-service/playsv .
# Run the playsv command by default when the container starts.
CMD ["./playsv"]
# Document that the service uses port 8080
EXPOSE 8082