Files
cpdaily_xiaozhushou/Dockerfile
T
becomer 2e2c161770 feat: init cpdaily-xiaozhushou with blue-green deploy
- backed/: Go Fiber backend with cpdaily integration
- frondend/: Vue 3 + Vite frontend
- Dockerfile: multi-stage build (Node → Go → Alpine)
- deploy/docker-compose.yml: production compose file
- .woodpecker/build.yml: CI/CD with blue-green zero-downtime deploy
- /health endpoint for deployment health checks
- Port 8884/8885 blue-green swap via 1Panel OpenResty
2026-07-03 15:37:55 +08:00

32 lines
1.1 KiB
Docker

# ============================================================
# Stage 1: 构建前端 (Vue 3 + Vite)
# ============================================================
FROM node:23-alpine AS frontend-builder
WORKDIR /build
COPY frondend/package*.json ./
RUN npm ci
COPY frondend/ ./
RUN npm run build
# ============================================================
# Stage 2: 构建后端 (Go + Fiber)
# ============================================================
FROM golang:1.26-alpine AS backend-builder
WORKDIR /build
ENV GOPROXY=https://goproxy.cn,direct
COPY backed/go.mod backed/go.sum ./
RUN go mod download
COPY backed/ ./
RUN go build -ldflags="-s -w" -o server ./cmd/server/
# ============================================================
# Stage 3: 运行时镜像(仅含二进制 + 前端静态文件)
# ============================================================
FROM alpine:latest
RUN apk add --no-cache ca-certificates tzdata
COPY --from=backend-builder /build/server /app/server
COPY --from=frontend-builder /build/dist /app/dist
WORKDIR /app
EXPOSE 8093
CMD ["./server"]