Files
sale/backend/Dockerfile
T
2026-04-27 11:01:36 +08:00

31 lines
583 B
Docker

FROM golang:1.22-alpine AS builder
WORKDIR /app
RUN apk add --no-cache git nodejs npm
COPY backend/go.mod backend/go.sum ./
RUN go mod download
COPY backend ./backend
COPY frontend ./frontend
RUN npm ci --prefix frontend
RUN npm run build --prefix frontend
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/server ./backend/cmd/server
FROM alpine:latest
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/backend/uploads ./uploads
EXPOSE 8080
CMD ["./server"]