From be193b31eb03768232d981c17b4f274d2b98d616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gast=C3=B3n=20Fournier?= Date: Thu, 17 Apr 2025 15:33:46 +0200 Subject: [PATCH] Use nginx to serve static --- .github/docker-compose.test.yml | 15 ++++++--------- .github/workflows/e2e.frontend.yaml | 5 +++++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/docker-compose.test.yml b/.github/docker-compose.test.yml index cf7a18216a..18d3b459d6 100644 --- a/.github/docker-compose.test.yml +++ b/.github/docker-compose.test.yml @@ -15,20 +15,17 @@ services: # The Unleash server contains the Unleash configuration and # communicates with server-side SDKs and the Unleash Proxy frontend: - build: - context: .. - dockerfile: frontend/Dockerfile + image: nginx + volumes: + - ./frontend/dist:/usr/share/nginx/html command: | - sh -c "echo \"Waiting for Unleash to start\" && \ - npx wait-on http://unleash:4242/health && \ - echo \"Unleash is up, starting frontend\" && \ - yarn run dev" + sh -c "printf 'server { listen 80; location / { add_header Access-Control-Allow-Origin \"*\" always; root /usr/share/nginx/html; try_files \$uri \$uri/ =404; }}' > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" ports: - - "3000:3000" + - "3000:80" environment: UNLEASH_API: "http://unleash:4242/" healthcheck: - test: wget --no-verbose --tries=1 --spider http://localhost:3000/login || exit 1 + test: wget --no-verbose --tries=1 --spider http://localhost:80/login || exit 1 interval: 1s timeout: 1m retries: 10 diff --git a/.github/workflows/e2e.frontend.yaml b/.github/workflows/e2e.frontend.yaml index 3f7614c126..006fa5d77f 100644 --- a/.github/workflows/e2e.frontend.yaml +++ b/.github/workflows/e2e.frontend.yaml @@ -21,6 +21,11 @@ jobs: echo "$GITHUB_CONTEXT" - name: Checkout uses: actions/checkout@v4 + - name: Build static frontend + run: | + cd frontend + yarn install --immutable + yarn build - name: Start Unleash test instance run: | docker compose -f .github/docker-compose.test.yml up -d --wait -t 90