34 lines
601 B
Docker
34 lines
601 B
Docker
# Dockerfile for Matrix GPT Bot
|
|
|
|
# --- Build Stage ---
|
|
FROM golang:1.24-alpine AS builder
|
|
|
|
# Install git for module downloads
|
|
RUN apk add --no-cache git
|
|
|
|
WORKDIR /app
|
|
|
|
# Cache dependencies
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy the rest of the source
|
|
COPY . .
|
|
|
|
# Build the binary
|
|
RUN go build -o matrix-gpt-bot ./main.go
|
|
|
|
# --- Final Stage ---
|
|
FROM alpine:3.18
|
|
|
|
# Install CA certificates
|
|
RUN apk add --no-cache ca-certificates
|
|
|
|
WORKDIR /root/
|
|
|
|
# Copy the built binary from the builder stage
|
|
COPY --from=builder /app/matrix-gpt-bot .
|
|
|
|
# Define the entrypoint
|
|
ENTRYPOINT ["./matrix-gpt-bot"]
|