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
|
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
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy only the dependency files first
|
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
# Copy the entire project structure
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build from the current directory (.) so it finds the module root
|
RUN CGO_ENABLED=0 GOOS=linux go build -o bot .
|
||||||
RUN go build -o /app/bot .
|
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
@@ -26,6 +18,7 @@ WORKDIR /root/
|
|||||||
|
|
||||||
COPY --from=builder /app/bot .
|
COPY --from=builder /app/bot .
|
||||||
COPY --from=builder /app/templates ./templates
|
COPY --from=builder /app/templates ./templates
|
||||||
|
COPY --from=builder /app/static ./static
|
||||||
COPY .env .
|
COPY .env .
|
||||||
|
|
||||||
ENV DB_PATH=/data/bot.db
|
ENV DB_PATH=/data/bot.db
|
||||||
|
|||||||
Reference in New Issue
Block a user