diff --git a/Dockerfile b/Dockerfile index 2ce3b69..436a1d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,23 @@ # Start from a Go base image -FROM golang:latest as builder +FROM golang:alpine3.19 AS builder # Set the working directory WORKDIR /app # Copy the source code into the container COPY . . +RUN go mod download # Build the application -RUN go build -o mybot . +RUN CGO_ENABLED=0 GOOS=linux go build -o mybot . # Use a small base image -FROM alpine:latest +FROM alpine:edge -WORKDIR /root/ +WORKDIR /app/ # Copy the binary from the builder stage -COPY --from=builder /app/mybot . +COPY --from=builder /app/mybot /app/ # Command to run the executable CMD ["./mybot"]