diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..42061c0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +README.md \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index bec7faf..ffd1e0c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,20 @@ -FROM golang:alpine -RUN apk add git +FROM golang:alpine AS builder ENV GOPROXY https://modules.fromouter.space -RUN go get git.fromouter.space/mcg/mlpdraftbot +ENV GO111MODULE=on -ENTRYPOINT [ "mlpdraftbot" ] -EXPOSE 5749 \ No newline at end of file +WORKDIR /app + +# Get updated modules +COPY ./ ./ +RUN go mod download + +# Compile code +RUN CGO_ENABLED=0 go build -o /svc . + +FROM scratch AS final + +# Import the compiled executable from the first stage. +COPY --from=builder /svc /svc + +CMD [ "/svc" ] \ No newline at end of file