d5398ee671
- Change cpu_cores from int to float64 in backend models, handlers, services - Update frontend CreateInstancePage to accept decimal CPU values (step 0.1) - Add DB migration 009_cpu_cores_decimal.sql for DECIMAL(10,2) columns - Update deployment manifests (k8s, k3s, incluster) schema definitions - Add GOFLAGS/GOPROXY/GOSUMDB build args to Dockerfile so that --build-arg values passed by build scripts take effect during go mod download
36 lines
617 B
Docker
36 lines
617 B
Docker
# Build stage
|
|
FROM golang:1.21-alpine AS builder
|
|
ENV GOPROXY=https://goproxy.cn,direct
|
|
ENV GOSUMDB=sum.golang.google.cn
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies
|
|
RUN apk add --no-cache git
|
|
|
|
# Copy go mod files
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o bin/server cmd/server/main.go
|
|
|
|
# Final stage
|
|
FROM alpine:latest
|
|
|
|
RUN apk --no-cache add ca-certificates
|
|
|
|
WORKDIR /root/
|
|
|
|
# Copy the binary from builder
|
|
COPY --from=builder /app/bin/server .
|
|
|
|
# Expose port
|
|
EXPOSE 8080
|
|
|
|
# Run the binary
|
|
CMD ["./server"]
|