Files
doc_ai_backed/Dockerfile
2025-12-11 11:22:56 +08:00

46 lines
828 B
Docker

# Build stage
FROM golang:1.20-alpine AS builder
WORKDIR /app
# Copy source code
COPY . .
ENV GOPROXY=https://goproxy.cn,direct
ENV GOSUMDB=off
# Build binary
RUN go mod download && \
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o doc_ai ./main.go
# Runtime stage
FROM alpine:latest
# Set timezone
RUN apk add --no-cache tzdata && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
WORKDIR /app
# Copy binary from builder
COPY --from=builder /app/doc_ai .
# Copy config files
COPY config/config_*.yaml ./config/
# Create data directory
RUN mkdir -p /data/formula && \
chmod -R 755 /data
# Expose port (update based on your config)
EXPOSE 8024
# Set entrypoint
ENTRYPOINT ["./doc_ai"]
# Default command (can be overridden)
CMD ["-env", "prod"]