30 lines
512 B
Docker
30 lines
512 B
Docker
FROM golang:1.21-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
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
|
|
|
|
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
|
|
|
|
CMD ["./server"]
|