mirror of
https://github.com/tiennm99/store-scraper-bot.git
synced 2026-08-31 04:30:40 +00:00
32 lines
532 B
Docker
32 lines
532 B
Docker
# Build stage
|
|
FROM golang:1.21-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install build dependencies
|
|
RUN apk add --no-cache git
|
|
|
|
# Copy go mod files
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o bot ./cmd/bot
|
|
|
|
# Final stage
|
|
FROM alpine:latest
|
|
|
|
RUN apk --no-cache add ca-certificates tzdata
|
|
|
|
WORKDIR /root/
|
|
|
|
# Copy the binary from builder
|
|
COPY --from=builder /app/bot .
|
|
|
|
# Expose no ports (bot uses long polling)
|
|
|
|
CMD ["./bot"]
|