Add Dockerfile
This commit is contained in:
parent
b9c485e76d
commit
b85b4e2a5c
2 changed files with 42 additions and 0 deletions
5
.dockerignore
Normal file
5
.dockerignore
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
*.session
|
||||||
|
*.yaml
|
||||||
|
telegram-antiscam
|
||||||
37
Dockerfile
Normal file
37
Dockerfile
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
# Build stage
|
||||||
|
FROM golang:1.23-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
|
# Install build dependencies
|
||||||
|
RUN apk add --no-cache git
|
||||||
|
|
||||||
|
# Copy go mod files
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
|
||||||
|
# Download dependencies
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
# Copy source code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the binary
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o telegram-antiscam .
|
||||||
|
|
||||||
|
# Runtime stage
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install CA certificates for HTTPS
|
||||||
|
RUN apk add --no-cache ca-certificates
|
||||||
|
|
||||||
|
# Copy binary from builder
|
||||||
|
COPY --from=builder /build/telegram-antiscam .
|
||||||
|
|
||||||
|
# Set default config path
|
||||||
|
ENV CONFIG_PATH=/app/config.yaml
|
||||||
|
|
||||||
|
# Run the bot
|
||||||
|
ENTRYPOINT ["/app/telegram-antiscam"]
|
||||||
|
CMD ["${CONFIG_PATH}"]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue