forked from tgdrive/teldrive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (24 loc) · 828 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
33
34
35
36
37
38
39
40
41
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:alpine as builder
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH
RUN apk update && apk add --no-cache git ca-certificates make tzdata nodejs npm && update-ca-certificates
WORKDIR /app
# use modules
COPY go.mod .
ENV GO111MODULE=on
RUN go mod download && go mod verify
COPY . .
#build ui
RUN make pre-ui && make ui
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \
-ldflags='-w -s -extldflags "-static"' -a \
-o /app/teldrive .
FROM --platform=${TARGETPLATFORM:-linux/amd64} busybox
WORKDIR /app
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /app/teldrive /app/teldrive
EXPOSE 8080
ENTRYPOINT ["/app/teldrive"]