29 lines
779 B
Docker
29 lines
779 B
Docker
# Use the official Go 1.23 image for building the application
|
|
FROM golang:1.23-alpine AS builder
|
|
|
|
# Set the working directory inside the container
|
|
WORKDIR /app
|
|
|
|
# Copy the Go modules manifest and download dependencies
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy the rest of the application source code
|
|
COPY . .
|
|
|
|
# Build the Go application from the appropriate directory inside 'cmd'
|
|
RUN go build -o discord-scores-bot ./cmd/main.go
|
|
|
|
# Create a minimal runtime image
|
|
FROM alpine:latest
|
|
RUN apk --no-cache add ca-certificates
|
|
|
|
# Set the working directory
|
|
WORKDIR /root/
|
|
|
|
# Copy the built Go binaries from the builder stage
|
|
COPY --from=builder /app/discord-scores-bot .
|
|
|
|
# Run the bot (use separate Dockerfiles if needed for distinct deployments)
|
|
CMD ["./discord-scores-bot"]
|