diff --git a/files/prebuild/build-frontend.sh b/files/prebuild/build-frontend.sh index 6122c321..699d7d09 100755 --- a/files/prebuild/build-frontend.sh +++ b/files/prebuild/build-frontend.sh @@ -1,4 +1,18 @@ #!/bin/bash -eu + cd client -npm clean-install --no-audit --fund=false --update-notifier=false -npm run build + +if [[ ${SKIP_FRONTEND_BUILD-} != "" ]]; then + echo "[build-frontend] Skipping frontend build." + + # Create minimal fake frontend to allow tests to pass: + mkdir -p dist + echo > dist/blank.html + echo > dist/favicon.ico + echo > dist/index.html '
' + + exit +else + npm clean-install --no-audit --fund=false --update-notifier=false + npm run build +fi diff --git a/nginx.dockerfile b/nginx.dockerfile index 5129ac67..b2b94712 100644 --- a/nginx.dockerfile +++ b/nginx.dockerfile @@ -8,6 +8,8 @@ RUN apt-get update \ COPY ./ ./ RUN files/prebuild/write-version.sh + +ARG SKIP_FRONTEND_BUILD RUN files/prebuild/build-frontend.sh diff --git a/test/nginx.test.docker-compose.yml b/test/nginx.test.docker-compose.yml index f7af4ace..4a863054 100644 --- a/test/nginx.test.docker-compose.yml +++ b/test/nginx.test.docker-compose.yml @@ -17,6 +17,8 @@ services: build: context: .. dockerfile: nginx.dockerfile + args: + SKIP_FRONTEND_BUILD: true depends_on: - service - enketo