mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 14:06:36 +08:00
4f30e2d57b
The Dockerfiles and the release workflow still assumed the pre-refactor tree: go.mod, go.sum and main.go now live under backend/, so `COPY go.mod go.sum` failed outright, and the Go module is the bare `Wavelet`, so the buildinfo ldflags pointed at github.com/Rain-kl/Wavelet and stamped nothing. The frontend export was also overlaid onto ./plugins/... rather than the driver_http path that `//go:embed all:dist` actually reads. Repoint every packaging path at backend/, correct the ldflags module prefix, and assert dist/index.html in both docker stages, in build-embedded and in the release workflow, so a silently empty static export can no longer ship an API-only binary. Also carry pnpm-workspace.yaml into the cached install layer.
45 lines
883 B
Docker
45 lines
883 B
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
ARG GO_VERSION=1.25
|
|
ARG ALPINE_VERSION=3.23
|
|
|
|
FROM golang:${GO_VERSION}-alpine AS builder
|
|
|
|
ARG VERSION=dev
|
|
ARG BUILD_DATE=""
|
|
|
|
RUN apk add --no-cache ca-certificates git
|
|
|
|
WORKDIR /workspace
|
|
|
|
COPY backend/go.mod backend/go.sum ./backend/
|
|
RUN cd backend && go mod download
|
|
|
|
COPY . .
|
|
|
|
WORKDIR /workspace/backend
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build \
|
|
-trimpath \
|
|
-ldflags="-s -w -X Wavelet/pkg/buildinfo.Version=${VERSION} -X Wavelet/pkg/buildinfo.BuildTime=${BUILD_DATE}" \
|
|
-o /out/wavelet \
|
|
./main.go
|
|
|
|
FROM alpine:${ALPINE_VERSION}
|
|
|
|
ARG TZ=Asia/Shanghai
|
|
|
|
RUN apk add --no-cache ca-certificates tzdata postgresql-client && \
|
|
cp /usr/share/zoneinfo/${TZ} /etc/localtime && \
|
|
echo "${TZ}" > /etc/timezone
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /out/wavelet ./wavelet
|
|
COPY docs ./docs
|
|
|
|
EXPOSE 8000
|
|
|
|
ENTRYPOINT ["./wavelet"]
|
|
CMD ["api"]
|