FROM golang:1.18 AS builder
ARG GITHUB_TOKEN
ENV GOPRIVATE="github.com/tidbcloud"
WORKDIR /go/src/debug-portal/
COPY . ./
RUN git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/" && make build

FROM alpine:latest  
WORKDIR /etc/debug-portal
COPY --from=builder /go/src/debug-portal/bin/server ./bin/
RUN chmod +x /etc/debug-portal/bin/server
EXPOSE 8080 9191
ENTRYPOINT ["/etc/debug-portal/bin/server", "--config-path=/etc/debug-portal/conf/config.yaml"]

