FROM golang:alpine as builder

WORKDIR /data
COPY . .

RUN go env -w GO111MODULE=on \
    && go env -w GOPROXY=https://goproxy.cn,direct \
    && go env -w CGO_ENABLED=0 \
    && go env \
    && go mod tidy \
    && go build -o pychr .

FROM alpine:latest

WORKDIR /data

COPY --from=0 /data/pychr ./
COPY --from=0 /data/resource ./resource/
COPY --from=0 /data/config.yaml ./

EXPOSE 8888
ENTRYPOINT ./pychr -c config.yaml
