From 7fd5a60134aff2625efa3af268e9fd5801b73c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lyse=20Viard?= Date: Sat, 8 Feb 2025 11:56:45 +0100 Subject: [PATCH] dev: resilient gateway build for dev front MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Élyse Viard --- docker/docker-compose.front.yml | 3 +++ docker/docker-compose.host-front.yml | 3 +++ gateway/Dockerfile | 7 ++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docker/docker-compose.front.yml b/docker/docker-compose.front.yml index 8673d68d4fe..0a93895181e 100644 --- a/docker/docker-compose.front.yml +++ b/docker/docker-compose.front.yml @@ -3,6 +3,9 @@ services: image: ghcr.io/openrailassociation/osrd-edge/osrd-gateway:${TAG-dev}-${GATEWAY_FLAVOR-standalone} volumes: - "./docker/gateway.dev.front.toml:/srv/gateway.toml" + build: + args: + SKIP_BAD_FRONT: "1" front: image: ghcr.io/openrailassociation/osrd-edge/osrd-front:${TAG-dev}-dev diff --git a/docker/docker-compose.host-front.yml b/docker/docker-compose.host-front.yml index e69a697d64c..66f059ce997 100644 --- a/docker/docker-compose.host-front.yml +++ b/docker/docker-compose.host-front.yml @@ -3,6 +3,9 @@ services: image: ghcr.io/openrailassociation/osrd-edge/osrd-gateway:${TAG-dev}-${GATEWAY_FLAVOR-standalone} volumes: - "./docker/gateway.dev.host-front.toml:/srv/gateway.toml" + build: + args: + SKIP_BAD_FRONT: "1" front: image: ghcr.io/openrailassociation/osrd-edge/osrd-front:${TAG-dev}-dev diff --git a/gateway/Dockerfile b/gateway/Dockerfile index 04bb935168d..d96c3510eb4 100644 --- a/gateway/Dockerfile +++ b/gateway/Dockerfile @@ -63,6 +63,9 @@ CMD ["/usr/local/bin/osrd_gateway"] FROM node:23-bookworm AS front_build WORKDIR /app +# Add build argument for skipping failed front +ARG SKIP_BAD_FRONT=0 + # Build dependencies COPY --from=front_src package.json package-lock.json /app/ RUN npm install --frozen-lockfile @@ -74,7 +77,9 @@ ENV VITE_OSRD_GIT_DESCRIBE=${OSRD_GIT_DESCRIBE} # Generate the licenses file and build COPY --from=front_src . /app ENV NODE_OPTIONS="--max_old_space_size=4096" -RUN npm run generate-licenses && npm run build +RUN (npm run generate-licenses && npm run build) || \ + (test "$SKIP_BAD_FRONT" = "1" && mkdir -p build && \ + echo '

Front build failed : check logs.

' > build/index.html) ####################### # Running env : front #