2023-08-24 19:57:50 +08:00
|
|
|
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:alpine as builder
|
|
|
|
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
ARG BUILDPLATFORM
|
|
|
|
ARG TARGETOS
|
|
|
|
ARG TARGETARCH
|
|
|
|
|
2023-08-16 05:53:02 +08:00
|
|
|
|
2023-09-08 18:37:11 +08:00
|
|
|
RUN apk update && apk add --no-cache git ca-certificates make tzdata nodejs npm && update-ca-certificates
|
2023-08-16 05:53:02 +08:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2023-09-08 18:37:11 +08:00
|
|
|
|
2023-08-16 05:53:02 +08:00
|
|
|
# use modules
|
|
|
|
COPY go.mod .
|
|
|
|
|
|
|
|
ENV GO111MODULE=on
|
|
|
|
RUN go mod download && go mod verify
|
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
2023-09-08 18:37:11 +08:00
|
|
|
#build ui
|
|
|
|
RUN make pre-ui && make ui
|
|
|
|
|
2023-08-24 19:57:50 +08:00
|
|
|
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \
|
2023-08-16 05:53:02 +08:00
|
|
|
-ldflags='-w -s -extldflags "-static"' -a \
|
2023-08-18 05:25:22 +08:00
|
|
|
-o /app/teldrive .
|
2023-08-16 05:53:02 +08:00
|
|
|
|
|
|
|
|
2023-08-27 19:08:43 +08:00
|
|
|
FROM --platform=${TARGETPLATFORM:-linux/amd64} busybox
|
2023-08-16 05:53:02 +08:00
|
|
|
|
2023-08-18 05:25:22 +08:00
|
|
|
WORKDIR /app
|
|
|
|
|
2023-08-16 05:53:02 +08:00
|
|
|
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
|
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
|
|
|
2023-08-18 05:25:22 +08:00
|
|
|
COPY --from=builder /app/teldrive /app/teldrive
|
2023-08-16 05:53:02 +08:00
|
|
|
|
2023-08-16 06:33:28 +08:00
|
|
|
EXPOSE 8080
|
|
|
|
|
2023-08-18 05:25:22 +08:00
|
|
|
ENTRYPOINT ["/app/teldrive"]
|