updated docker file for static files
This commit is contained in:
11
Dockerfile
11
Dockerfile
@@ -1,21 +1,13 @@
|
||||
FROM golang:1.25-alpine AS builder
|
||||
|
||||
# Ensure CGO is off for a static binary
|
||||
ENV CGO_ENABLED=0
|
||||
# Ensure Go modules are strictly enforced
|
||||
ENV GO111MODULE=on
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy only the dependency files first
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy the entire project structure
|
||||
COPY . .
|
||||
|
||||
# Build from the current directory (.) so it finds the module root
|
||||
RUN go build -o /app/bot .
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o bot .
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
@@ -26,6 +18,7 @@ WORKDIR /root/
|
||||
|
||||
COPY --from=builder /app/bot .
|
||||
COPY --from=builder /app/templates ./templates
|
||||
COPY --from=builder /app/static ./static
|
||||
COPY .env .
|
||||
|
||||
ENV DB_PATH=/data/bot.db
|
||||
|
||||
Reference in New Issue
Block a user