23 lines
454 B
Docker
23 lines
454 B
Docker
FROM golang:1.24-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
# for C stuff (CGO_ENABLED --> sqlite3)
|
|
RUN apk add --no-cache build-base
|
|
|
|
# Copy go.mod and go.sum to download dependencies
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy the rest of the code
|
|
COPY . .
|
|
RUN CGO_ENABLED=1 GOOS=linux go build -o bot .
|
|
|
|
FROM alpine:latest
|
|
WORKDIR /app
|
|
COPY --from=builder /app/bot .
|
|
|
|
# DB stuff
|
|
VOLUME /app/data
|
|
RUN mkdir -p /app/data && chmod 755 /app/data
|
|
|
|
CMD ["./bot"] |