-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (35 loc) · 1.62 KB
/
Dockerfile
File metadata and controls
53 lines (35 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# ─── Stage 1: Build Frontend ──────────────────────────────────────────────────
FROM node:20-alpine AS frontend-builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --prefer-offline
COPY index.html vite.config.ts tsconfig*.json postcss.config.cjs tailwind.config.cjs ./
COPY src/ ./src/
COPY public/ ./public/
RUN npm run build
# ─── Stage 2: Build Backend ───────────────────────────────────────────────────
FROM golang:1.21-alpine AS backend-builder
WORKDIR /app
COPY backend/go.mod backend/go.sum ./
RUN go mod download
COPY backend/ ./
# Build statically linked binary
RUN CGO_ENABLED=0 GOOS=linux go build \
-ldflags="-s -w" \
-o /github-command-center .
# ─── Stage 3: Final Image ─────────────────────────────────────────────────────
FROM alpine:3.19
RUN apk --no-cache add ca-certificates git
WORKDIR /app
# Copy compiled binary
COPY --from=backend-builder /github-command-center ./github-command-center
# Copy built frontend assets (served by Go binary)
COPY --from=frontend-builder /app/dist ./dist
COPY --from=frontend-builder /app/public ./public
# Runtime configuration
EXPOSE 8765
ENV GIN_MODE=release
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD wget -qO- http://localhost:8765/api/github/user || exit 1
ENTRYPOINT ["./github-command-center"]