Files
doc_ai_backed/Dockerfile

41 lines
741 B
Docker
Raw Normal View History

2025-12-10 18:33:37 +08:00
# Build stage
2025-12-10 23:17:24 +08:00
FROM golang:1.20-alpine AS builder
2025-12-10 18:33:37 +08:00
WORKDIR /app
# Copy source code
COPY . .
# Build binary
2025-12-10 23:17:24 +08:00
RUN CGO_ENABLED=0 GOOS=linux go build -mod=vendor -o doc_ai ./main.go
2025-12-10 18:33:37 +08:00
# Runtime stage
2025-12-10 23:17:24 +08:00
FROM alpine:latest
2025-12-10 18:33:37 +08:00
# 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
2025-12-10 23:17:24 +08:00
COPY --from=builder /app/doc_ai .
2025-12-10 18:33:37 +08:00
# 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
2025-12-10 23:17:24 +08:00
ENTRYPOINT ["./doc_ai"]
2025-12-10 18:33:37 +08:00
# Default command (can be overridden)
CMD ["-env", "prod"]