Files
novatask/Dockerfile
2025-03-21 16:50:53 +08:00

32 lines
730 B
Docker

FROM golang:1.24 AS builder
LABEL stage=gobuilder
ENV CGO_ENABLED=0
ENV GOPROXY=https://goproxy.cn,direct
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
#RUN apk update --no-cache && apk add --no-cache tzdata
WORKDIR /build
ADD go.mod .
ADD go.sum .
RUN go mod download
COPY . .
COPY ./etc /app/etc
RUN go build -ldflags="-s -w" -o /app/novatask novatask.go
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /usr/share/zoneinfo/UTC /usr/share/zoneinfo/UTC
ENV TZ=UTC
WORKDIR /app
COPY --from=builder /app/novatask /app/novatask
COPY --from=builder /app/etc /app/etc
CMD ["./novatask", "-f", "etc/novatask.yaml"]