From 3e32e11da79a79f2055d7115d58bda0c9a8d6470 Mon Sep 17 00:00:00 2001 From: Daniel Tam Date: Sat, 9 Jul 2022 07:19:44 +0000 Subject: [PATCH] updated to multistage build, changed to alpine image --- Dockerfile | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8c44344..ffa1024 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,14 @@ # syntax=docker/dockerfile:1 -FROM golang:latest - +FROM golang:latest AS bunny_build WORKDIR /app - RUN git clone https://github.com/omgdanieltam/BunnyBot.git . - RUN go mod download +RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o ./BunnyBot -COPY auth.json ./ - -RUN go build -o ./BunnyBot - +FROM alpine:latest +WORKDIR /app +COPY --from=bunny_build /app/BunnyBot /app/BunnyBot RUN chmod +x ./BunnyBot - +COPY auth.json ./ CMD [ "./BunnyBot" ]