-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (25 loc) · 738 Bytes
/
Dockerfile
File metadata and controls
38 lines (25 loc) · 738 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
34
35
36
37
38
FROM alpine:latest as certs
# getting certs
RUN apk update && apk upgrade && apk add --no-cache ca-certificates
FROM golang:latest as build
# set work dir
WORKDIR /app
# copy the source files
COPY . .
# disable crosscompiling
ENV CGO_ENABLED=0
# compile linux only
ENV GOOS=linux
# build the binary with debug information removed
RUN go build -ldflags '-w -s' -a -installsuffix cgo -o server
FROM alpine:latest
# copy our static linked library
COPY --from=build /app/server .
# copy migrations
COPY --from=build /app/migrations /migrations
# copy certs
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# tell we are exposing our service on port 8080, 8081
EXPOSE 8080 8081
# run it!
CMD ["./server", "s"]