mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-17 16:37:43 +00:00
build(e2e): add fast local Docker Compose setup for E2E tests
This commit is contained in:
parent
cdf52cc4e5
commit
b099ffe627
3 changed files with 72 additions and 1 deletions
14
Dockerfile.e2e.dev.fast
Normal file
14
Dockerfile.e2e.dev.fast
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
FROM node:22-bookworm
|
||||||
|
|
||||||
|
# Install Angular CLI globally and curl for healthcheck
|
||||||
|
RUN npm install -g @angular/cli && apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Default port (can be overridden via environment variable)
|
||||||
|
ENV APP_PORT=4242
|
||||||
|
|
||||||
|
EXPOSE ${APP_PORT}
|
||||||
|
|
||||||
|
# Start Angular dev server with dynamic port
|
||||||
|
CMD ["sh", "-c", "ng serve --port ${APP_PORT} --host 0.0.0.0"]
|
||||||
50
docker-compose.e2e.fast.yaml
Normal file
50
docker-compose.e2e.fast.yaml
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
# Docker Compose for fast local E2E tests
|
||||||
|
# Uses volume mounts instead of copying source/installing deps
|
||||||
|
# Requires: npm install to be run locally first
|
||||||
|
services:
|
||||||
|
# Angular development server for E2E tests
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile.e2e.dev.fast
|
||||||
|
ports:
|
||||||
|
- '${APP_PORT:-4242}:${APP_PORT:-4242}'
|
||||||
|
environment:
|
||||||
|
- APP_PORT=${APP_PORT:-4242}
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
- /app/.angular # Exclude .angular cache (use container's)
|
||||||
|
healthcheck:
|
||||||
|
test: ['CMD', 'curl', '-sf', 'http://localhost:${APP_PORT:-4242}']
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 30
|
||||||
|
start_period: 120s
|
||||||
|
|
||||||
|
# WebDAV sync server (for sync tests)
|
||||||
|
webdav:
|
||||||
|
image: hacdias/webdav:latest
|
||||||
|
ports:
|
||||||
|
- '${WEBDAV_PORT:-2345}:${WEBDAV_PORT:-2345}'
|
||||||
|
environment:
|
||||||
|
- PORT=${WEBDAV_PORT:-2345}
|
||||||
|
volumes:
|
||||||
|
- ./webdav.yaml:/config.yml:ro
|
||||||
|
- webdav_data:/data
|
||||||
|
healthcheck:
|
||||||
|
test:
|
||||||
|
[
|
||||||
|
'CMD',
|
||||||
|
'wget',
|
||||||
|
'--quiet',
|
||||||
|
'--tries=1',
|
||||||
|
'--spider',
|
||||||
|
'http://localhost:${WEBDAV_PORT:-2345}/',
|
||||||
|
]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 3
|
||||||
|
start_period: 10s
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
webdav_data:
|
||||||
|
|
@ -1,16 +1,23 @@
|
||||||
# Docker Compose override for E2E tests
|
# Docker Compose override for E2E tests
|
||||||
# Note: For supersync tests, use both files: -f docker-compose.yaml -f docker-compose.e2e.yaml
|
# Note: For supersync tests, use both files: -f docker-compose.yaml -f docker-compose.e2e.yaml
|
||||||
# This file is standalone for app/webdav tests only
|
# This file is standalone for app/webdav tests only
|
||||||
|
#
|
||||||
|
# FAST LOCAL ALTERNATIVE: Run `ng serve` locally + `npm run e2e:webdav` (only webdav in Docker)
|
||||||
services:
|
services:
|
||||||
# Angular development server for E2E tests
|
# Angular development server for E2E tests
|
||||||
|
# Uses volume mount to avoid copying/rebuilding node_modules
|
||||||
|
# Requires: npm install to be run locally first
|
||||||
app:
|
app:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.e2e.dev
|
dockerfile: Dockerfile.e2e.dev.fast
|
||||||
ports:
|
ports:
|
||||||
- '${APP_PORT:-4242}:${APP_PORT:-4242}'
|
- '${APP_PORT:-4242}:${APP_PORT:-4242}'
|
||||||
environment:
|
environment:
|
||||||
- APP_PORT=${APP_PORT:-4242}
|
- APP_PORT=${APP_PORT:-4242}
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
- /app/.angular # Exclude .angular cache (use container's)
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD', 'curl', '-sf', 'http://localhost:${APP_PORT:-4242}']
|
test: ['CMD', 'curl', '-sf', 'http://localhost:${APP_PORT:-4242}']
|
||||||
interval: 10s
|
interval: 10s
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue