file_system/Dockerfile
root 79162a4205 Fix: Configure Go proxy for faster dependency downloads
- Added GOPROXY=https://goproxy.cn,direct for Chinese mirror
- Added GOSUMDB=sum.golang.google.cn for checksum database
- Fixes timeout issues when downloading Go modules during CI/CD build
- Resolves build failure due to network connectivity to proxy.golang.org

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-19 10:09:18 +08:00

42 lines
940 B
Docker

# Build Stage
FROM 192.168.1.154:31010/docker/alpine:latest AS builder
WORKDIR /app
# Install Go
RUN apk add --no-cache go
# Configure Go proxy for faster downloads
ENV GOPROXY=https://goproxy.cn,direct
ENV GOSUMDB=sum.golang.google.cn
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN go mod download
# Copy the source from the current directory to the Working Directory inside the container
COPY . .
# Build the Go app
RUN go build -o server ./cmd/server
# Run Stage
FROM 192.168.1.154:31010/docker/alpine:latest
WORKDIR /app
# Copy the Pre-built binary from the previous stage
COPY --from=builder /app/server .
# Copy web resources
COPY --from=builder /app/web ./web
# Copy docs
COPY --from=builder /app/docs ./docs
# Expose port 8080 to the outside world
EXPOSE 8080
# Command to run the executable
CMD ["./server"]