diff --git a/docker-compose.e2e.yaml b/docker-compose.e2e.yaml index 650eb7402..7196597f7 100644 --- a/docker-compose.e2e.yaml +++ b/docker-compose.e2e.yaml @@ -4,26 +4,26 @@ # # FAST LOCAL ALTERNATIVE: Run `ng serve` locally + `npm run e2e:webdav` (only webdav in Docker) services: - # Angular development server for E2E tests - # Uses volume mount to avoid copying/rebuilding node_modules - # Requires: npm install to be run locally first + # Production Angular build for E2E tests + # Uses production Dockerfile with nginx app: build: context: . - dockerfile: Dockerfile.e2e.dev.fast + dockerfile: Dockerfile + args: + UNSPLASH_KEY: ${UNSPLASH_KEY:-DUMMY_UNSPLASH_KEY} + UNSPLASH_CLIENT_ID: ${UNSPLASH_CLIENT_ID:-DUMMY_UNSPLASH_CLIENT_ID} ports: - '${APP_PORT:-4242}:${APP_PORT:-4242}' environment: - APP_PORT=${APP_PORT:-4242} - volumes: - - .:/app - - /app/.angular # Exclude .angular cache (use container's) + - WEBDAV_BACKEND=${WEBDAV_BACKEND:-} healthcheck: test: ['CMD', 'curl', '-sf', 'http://localhost:${APP_PORT:-4242}'] interval: 10s timeout: 5s retries: 30 - start_period: 120s + start_period: 30s # WebDAV sync server (for sync tests) webdav: diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 414d46e33..69fc7c32d 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,5 +1,9 @@ #!/bin/sh +# Set default port if not provided +: "${APP_PORT:=80}" +export APP_PORT + # Generate ./assets/sync-config-default-override.json from environment variables JSON="{}" JSON_PATH=./assets/sync-config-default-override.json diff --git a/nginx/default.conf.template b/nginx/default.conf.template index 6f93ad234..a9b9533b8 100644 --- a/nginx/default.conf.template +++ b/nginx/default.conf.template @@ -4,13 +4,14 @@ map "" $webdav_backend { } server { - listen 80; + listen ${APP_PORT}; server_name localhost; # serve super-productivity as static files at the path / location / { root /usr/share/nginx/html; index index.html index.htm; + try_files $uri $uri/ /index.html; } # forward requests starting with "/webdav/" to $WEBDAV_BACKEND