You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 lines
995 B

# golang build
FROM golang:1.17.8-alpine3.15 AS go-builder
RUN echo -e http://mirrors.ustc.edu.cn/alpine/v3.13/main/ > /etc/apk/repositories
RUN apk add --update --no-cache make g++ git
ENV GOPROXY=https://goproxy.cn,https://goproxy.io,direct \
GO111MODULE=on \
CGO_ENABLED=1
RUN mkdir -p /app
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY dist ./dist
COPY html.go html.go
COPY main.go main.go
RUN go build -ldflags "-w -s -X main.Open=false" -o json-gen .
# runtime
FROM alpine:latest
RUN echo -e http://mirrors.ustc.edu.cn/alpine/v3.13/main/ > /etc/apk/repositories
COPY --from=go-builder /usr/local/go/lib/time/zoneinfo.zip /opt/zoneinfo.zip
ENV ZONEINFO /opt/zoneinfo.zip
RUN apk add --no-cache gettext tzdata && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone && \
date && \
apk del tzdata
WORKDIR /app
COPY --from=go-builder /app/json-gen /app/json-gen
EXPOSE 8333
ENTRYPOINT ./json-gen