R2: drop ./loadtest from the backend/gateway/telegram image builds
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Successful in 8s
CI / integration (pull_request) Successful in 13s
CI / ui (pull_request) Successful in 36s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m8s
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Successful in 8s
CI / integration (pull_request) Successful in 13s
CI / ui (pull_request) Successful in 36s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m8s
Adding the loadtest module to go.work (use ./loadtest + the scrabble/gateway replace it needs) broke the other services' Docker builds: their reduced workspace still referenced ./loadtest (not in their build context), failing with 'cannot load module loadtest: open loadtest/go.mod: no such file or directory'. Each service Dockerfile now also -dropuse=./loadtest; backend and telegram (which do not COPY ./gateway) additionally -dropreplace the loadtest-only scrabble/gateway replace. Verified by building all three images plus loadtest locally.
This commit is contained in:
+3
-2
@@ -30,8 +30,9 @@ COPY go.work go.work.sum ./
|
|||||||
COPY pkg ./pkg
|
COPY pkg ./pkg
|
||||||
COPY backend ./backend
|
COPY backend ./backend
|
||||||
|
|
||||||
# Reduce the workspace to what the backend needs: backend + pkg.
|
# Reduce the workspace to what the backend needs: backend + pkg. loadtest and the
|
||||||
RUN go work edit -dropuse=./gateway -dropuse=./platform/telegram
|
# gateway replace it requires are not in this context, so drop both.
|
||||||
|
RUN go work edit -dropuse=./gateway -dropuse=./platform/telegram -dropuse=./loadtest -dropreplace=scrabble/gateway@v0.0.0
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/backend ./backend/cmd/backend
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/backend ./backend/cmd/backend
|
||||||
|
|
||||||
# --- runtime -----------------------------------------------------------------
|
# --- runtime -----------------------------------------------------------------
|
||||||
|
|||||||
+3
-2
@@ -50,8 +50,9 @@ COPY gateway ./gateway
|
|||||||
RUN rm -rf gateway/internal/webui/dist
|
RUN rm -rf gateway/internal/webui/dist
|
||||||
COPY --from=ui /ui/dist gateway/internal/webui/dist
|
COPY --from=ui /ui/dist gateway/internal/webui/dist
|
||||||
|
|
||||||
# Reduce the workspace to what the gateway needs: gateway + pkg.
|
# Reduce the workspace to what the gateway needs: gateway + pkg (loadtest is not in
|
||||||
RUN go work edit -dropuse=./backend -dropuse=./platform/telegram
|
# this context; its scrabble/gateway replace targets ./gateway, which is present here).
|
||||||
|
RUN go work edit -dropuse=./backend -dropuse=./platform/telegram -dropuse=./loadtest
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/gateway ./gateway/cmd/gateway
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/gateway ./gateway/cmd/gateway
|
||||||
|
|
||||||
# --- runtime -----------------------------------------------------------------
|
# --- runtime -----------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
# Telegram connector image.
|
# Telegram connector image.
|
||||||
#
|
#
|
||||||
# The connector imports only the shared scrabble/pkg module, so the build drops the
|
# The connector imports only the shared scrabble/pkg module, so the build drops the
|
||||||
# other workspace modules (backend, gateway) and the scrabble-solver replace from a
|
# other workspace modules (backend, gateway, loadtest), the loadtest-only
|
||||||
# copy of go.work: it needs neither their sources nor the solver sibling checkout.
|
# scrabble/gateway replace and the scrabble-solver replace from a copy of go.work: it
|
||||||
|
# needs neither their sources nor the solver sibling checkout.
|
||||||
# Build from the repository ROOT so go.work, pkg/ and platform/telegram/ are all in
|
# Build from the repository ROOT so go.work, pkg/ and platform/telegram/ are all in
|
||||||
# the context (see deploy/docker-compose.yml, which sets context: ../../..).
|
# the context (see deploy/docker-compose.yml, which sets context: ../../..).
|
||||||
FROM golang:1.26.3-alpine AS build
|
FROM golang:1.26.3-alpine AS build
|
||||||
@@ -13,7 +14,7 @@ COPY pkg ./pkg
|
|||||||
COPY platform/telegram ./platform/telegram
|
COPY platform/telegram ./platform/telegram
|
||||||
|
|
||||||
# Reduce the workspace to what the connector needs: only pkg + platform/telegram.
|
# Reduce the workspace to what the connector needs: only pkg + platform/telegram.
|
||||||
RUN go work edit -dropuse=./backend -dropuse=./gateway -dropreplace=scrabble-solver
|
RUN go work edit -dropuse=./backend -dropuse=./gateway -dropuse=./loadtest -dropreplace=scrabble/gateway@v0.0.0 -dropreplace=scrabble-solver
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/telegram ./platform/telegram/cmd/telegram
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/telegram ./platform/telegram/cmd/telegram
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user