6f6a854337
vite.config.ts now proxies `/api` and `/galaxy.gateway.v1.EdgeGateway` to the gateway, so the browser sees only `localhost:5173` and never trips a cross-origin preflight. `.env.development` accordingly points `VITE_GATEWAY_BASE_URL` at the Vite origin. The proxy target is overridable via `VITE_DEV_PROXY_TARGET=...` for non-default gateways without touching the compose file. `gateway/Dockerfile` previously failed to build because gateway imports `galaxy/core` (replaced to `../ui/core` in `gateway/go.mod`) but the Dockerfile did not copy `ui/core/` into the build context nor declare the replace in the synthesised `go.work`. Adding both makes `docker build -f gateway/Dockerfile .` succeed; this is the same fix already shipped in `tools/local-dev/gateway.Dockerfile`, back-ported to upstream. Verified: - docker build -f gateway/Dockerfile . — builds cleanly - pnpm test 14/14, pnpm exec playwright test 44/44 (with CI=1 to force a fresh dev server; reuse keeps the previous startup env) - curl POST through localhost:5173/api/* and /galaxy.gateway.v1.* — reach the gateway, no CORS preflight on the browser side tools/local-dev/README.md updated with the new network map and the `VITE_DEV_PROXY_TARGET` override. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
77 lines
2.0 KiB
Docker
77 lines
2.0 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
# Build context is the workspace root (galaxy/), not the gateway/
|
|
# subdirectory, because the gateway module pulls
|
|
# galaxy/{backend,core,model,redisconn,transcoder} through the
|
|
# go.work replace directives. Build with:
|
|
#
|
|
# docker build -t galaxy/gateway:integration -f gateway/Dockerfile .
|
|
|
|
FROM golang:1.26.2-alpine AS builder
|
|
WORKDIR /src
|
|
ENV CGO_ENABLED=0 GOFLAGS=-trimpath
|
|
|
|
# galaxy/backend is needed only for proto/push/v1 (gRPC client of the
|
|
# backend Push.SubscribePush stream). Its other packages are not
|
|
# reachable from the gateway main and are not compiled.
|
|
COPY pkg/cronutil/ ./pkg/cronutil/
|
|
COPY pkg/error/ ./pkg/error/
|
|
COPY pkg/geoip/ ./pkg/geoip/
|
|
COPY pkg/model/ ./pkg/model/
|
|
COPY pkg/postgres/ ./pkg/postgres/
|
|
COPY pkg/redisconn/ ./pkg/redisconn/
|
|
COPY pkg/schema/ ./pkg/schema/
|
|
COPY pkg/transcoder/ ./pkg/transcoder/
|
|
COPY pkg/util/ ./pkg/util/
|
|
COPY ui/core/ ./ui/core/
|
|
COPY backend/ ./backend/
|
|
COPY gateway/ ./gateway/
|
|
|
|
RUN <<'EOF' cat > go.work
|
|
go 1.26.2
|
|
|
|
use (
|
|
./backend
|
|
./gateway
|
|
./pkg/cronutil
|
|
./pkg/error
|
|
./pkg/geoip
|
|
./pkg/model
|
|
./pkg/postgres
|
|
./pkg/redisconn
|
|
./pkg/schema
|
|
./pkg/transcoder
|
|
./pkg/util
|
|
./ui/core
|
|
)
|
|
|
|
replace (
|
|
galaxy/cronutil v0.0.0 => ./pkg/cronutil
|
|
galaxy/error v0.0.0 => ./pkg/error
|
|
galaxy/geoip v0.0.0 => ./pkg/geoip
|
|
galaxy/model v0.0.0 => ./pkg/model
|
|
galaxy/postgres v0.0.0 => ./pkg/postgres
|
|
galaxy/redisconn v0.0.0 => ./pkg/redisconn
|
|
galaxy/schema v0.0.0 => ./pkg/schema
|
|
galaxy/transcoder v0.0.0 => ./pkg/transcoder
|
|
galaxy/util v0.0.0 => ./pkg/util
|
|
galaxy/core v0.0.0 => ./ui/core
|
|
)
|
|
EOF
|
|
|
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
|
--mount=type=cache,target=/go/pkg/mod \
|
|
go build -ldflags="-s -w" -o /out/gateway ./gateway/cmd/gateway
|
|
|
|
FROM gcr.io/distroless/static-debian12:nonroot AS runtime
|
|
|
|
LABEL org.opencontainers.image.title="galaxy-gateway"
|
|
|
|
EXPOSE 8080
|
|
EXPOSE 9100
|
|
USER nonroot:nonroot
|
|
|
|
COPY --from=builder /out/gateway /usr/local/bin/gateway
|
|
|
|
ENTRYPOINT ["/usr/local/bin/gateway"]
|