-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (29 loc) · 1.03 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
FROM golang:1.13-alpine AS builder
LABEL maintainer="vaskovasilev94@yahoo.com"
RUN apk update && apk add --no-cache git gcc musl-dev curl
ENV GO111MODULE=on
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN go build -o /go/bin/ihcph -ldflags="-w -s" ./
# Optional: in case your application uses dynamic linking (often the case with CGO),
# this will collect dependent libraries so they're later copied to the final image
# NOTE: make sure you honor the license terms of the libraries you copy and distribute
WORKDIR /dist
RUN cp /go/bin/ihcph .
RUN ldd ./ihcph | tr -s '[:blank:]' '\n' | grep '^/' | \
xargs -I % sh -c 'mkdir -p $(dirname ./%); cp % ./%;'
#RUN mkdir -p lib64 && cp /lib64/ld-linux-x86-64.so.2 lib64/
#Include certificates
FROM alpine:latest as certs
RUN apk --update add ca-certificates
#Finish the build
FROM scratch
ENV PATH=/bin
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /dist /
EXPOSE 5000
ENV GIN_MODE=release
ENTRYPOINT ["/ihcph"]