Add Docker support: Dockerfile, docker-compose, GitHub Actions

This commit is contained in:
2026-04-27 10:41:48 +08:00
parent 2caef17124
commit 945df849f8
5 changed files with 14 additions and 76 deletions
+5 -1
View File
@@ -2,13 +2,16 @@ FROM golang:1.21-alpine AS builder
WORKDIR /app
RUN apk add --no-cache git
RUN apk add --no-cache git nodejs npm
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN npm ci --prefix frontend
RUN npm run build --prefix frontend
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/server ./cmd/server
FROM alpine:latest
@@ -18,6 +21,7 @@ WORKDIR /app
RUN apk add --no-cache ca-certificates tzdata
COPY --from=builder /app/server .
COPY --from=builder /app/frontend/dist ./static
COPY --from=builder /app/uploads ./uploads
EXPOSE 8080