-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
32 lines (27 loc) · 989 Bytes
/
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
FROM golang:1.20-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/torrentd -ldflags="-w -s" ./cmd
# 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/torrentd .
RUN ldd ./torrentd | tr -s '[:blank:]' '\n' | grep '^/' | \
xargs -I % sh -c 'mkdir -p $(dirname ./%); cp % ./%;'
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 ["/torrentd"]