🧑‍💻(docker) create a e2e compose configuration

We want to run the e2e tests using the frontend and y-provider
production images. We created a dedicated compose file adding just
missing services. These services are built in the CI.
This commit is contained in:
Manuel Raynaud
2025-06-13 10:19:27 +02:00
parent 56a945983e
commit 6c16e081de
4 changed files with 71 additions and 13 deletions

View File

@@ -86,7 +86,7 @@ jobs:
run: cd src/frontend/apps/e2e && yarn install --frozen-lockfile && yarn install-playwright chromium run: cd src/frontend/apps/e2e && yarn install --frozen-lockfile && yarn install-playwright chromium
- name: Start Docker services - name: Start Docker services
run: make bootstrap FLUSH_ARGS='--no-input' cache= run: make bootstrap-e2e FLUSH_ARGS='--no-input' cache=
- name: Run e2e tests - name: Run e2e tests
run: cd src/frontend/ && yarn e2e:test --project='chromium' run: cd src/frontend/ && yarn e2e:test --project='chromium'
@@ -125,7 +125,7 @@ jobs:
run: cd src/frontend/apps/e2e && yarn install --frozen-lockfile && yarn install-playwright firefox webkit chromium run: cd src/frontend/apps/e2e && yarn install --frozen-lockfile && yarn install-playwright firefox webkit chromium
- name: Start Docker services - name: Start Docker services
run: make bootstrap FLUSH_ARGS='--no-input' cache= run: make bootstrap-e2e FLUSH_ARGS='--no-input' cache=
- name: Run e2e tests - name: Run e2e tests
run: cd src/frontend/ && yarn e2e:test --project=firefox --project=webkit run: cd src/frontend/ && yarn e2e:test --project=firefox --project=webkit

View File

@@ -39,6 +39,7 @@ DOCKER_UID = $(shell id -u)
DOCKER_GID = $(shell id -g) DOCKER_GID = $(shell id -g)
DOCKER_USER = $(DOCKER_UID):$(DOCKER_GID) DOCKER_USER = $(DOCKER_UID):$(DOCKER_GID)
COMPOSE = DOCKER_USER=$(DOCKER_USER) docker compose COMPOSE = DOCKER_USER=$(DOCKER_USER) docker compose
COMPOSE_E2E = DOCKER_USER=$(DOCKER_USER) docker compose -f compose.yml -f compose-e2e.yml
COMPOSE_EXEC = $(COMPOSE) exec COMPOSE_EXEC = $(COMPOSE) exec
COMPOSE_EXEC_APP = $(COMPOSE_EXEC) app-dev COMPOSE_EXEC_APP = $(COMPOSE_EXEC) app-dev
COMPOSE_RUN = $(COMPOSE) run --rm COMPOSE_RUN = $(COMPOSE) run --rm
@@ -74,11 +75,16 @@ create-env-files: \
env.d/development/kc_postgresql env.d/development/kc_postgresql
.PHONY: create-env-files .PHONY: create-env-files
bootstrap: ## Prepare Docker images for the project base-bootstrap:
bootstrap: \ base-bootstrap: \
data/media \ data/media \
data/static \ data/static \
create-env-files \ create-env-files
.PHONY: base-bootstrap
bootstrap: ## Prepare Docker images for the project
bootstrap: \
base-bootstrap \
build \ build \
migrate \ migrate \
demo \ demo \
@@ -88,6 +94,18 @@ bootstrap: \
run run
.PHONY: bootstrap .PHONY: bootstrap
bootstrap-e2e: ## Prepare Docker production images to be used for e2e tests
bootstrap-e2e: \
base-bootstrap \
build-e2e \
migrate \
demo \
back-i18n-compile \
mails-install \
mails-build \
run-e2e
.PHONY: bootstrap-e2e
# -- Docker/compose # -- Docker/compose
build: cache ?= --no-cache build: cache ?= --no-cache
build: ## build the project containers build: ## build the project containers
@@ -103,7 +121,7 @@ build-backend: ## build the app-dev container
build-yjs-provider: cache ?= build-yjs-provider: cache ?=
build-yjs-provider: ## build the y-provider container build-yjs-provider: ## build the y-provider container
@$(COMPOSE) build y-provider $(cache) @$(COMPOSE) build y-provider-development $(cache)
.PHONY: build-yjs-provider .PHONY: build-yjs-provider
build-frontend: cache ?= build-frontend: cache ?=
@@ -111,8 +129,14 @@ build-frontend: ## build the frontend container
@$(COMPOSE) build frontend-development $(cache) @$(COMPOSE) build frontend-development $(cache)
.PHONY: build-frontend .PHONY: build-frontend
build-e2e: ## build the e2e container
@$(MAKE) build-backend
@$(COMPOSE_E2E) build frontend
@$(COMPOSE_E2E) build y-provider
.PHONY: build-e2e
down: ## stop and remove containers, networks, images, and volumes down: ## stop and remove containers, networks, images, and volumes
@$(COMPOSE) down @$(COMPOSE_E2E) down
.PHONY: down .PHONY: down
logs: ## display app-dev logs (follow mode) logs: ## display app-dev logs (follow mode)
@@ -121,7 +145,7 @@ logs: ## display app-dev logs (follow mode)
run-backend: ## Start only the backend application and all needed services run-backend: ## Start only the backend application and all needed services
@$(COMPOSE) up --force-recreate -d celery-dev @$(COMPOSE) up --force-recreate -d celery-dev
@$(COMPOSE) up --force-recreate -d y-provider @$(COMPOSE) up --force-recreate -d y-provider-development
@$(COMPOSE) up --force-recreate -d nginx @$(COMPOSE) up --force-recreate -d nginx
.PHONY: run-backend .PHONY: run-backend
@@ -131,12 +155,20 @@ run:
@$(COMPOSE) up --force-recreate -d frontend-development @$(COMPOSE) up --force-recreate -d frontend-development
.PHONY: run .PHONY: run
run-e2e: ## start the e2e server
run-e2e:
@$(MAKE) run-backend
@$(COMPOSE_E2E) stop y-provider-development
@$(COMPOSE_E2E) up --force-recreate -d frontend
@$(COMPOSE_E2E) up --force-recreate -d y-provider
.PHONY: run-e2e
status: ## an alias for "docker compose ps" status: ## an alias for "docker compose ps"
@$(COMPOSE) ps @$(COMPOSE_E2E) ps
.PHONY: status .PHONY: status
stop: ## stop the development server using Docker stop: ## stop the development server using Docker
@$(COMPOSE) stop @$(COMPOSE_E2E) stop
.PHONY: stop .PHONY: stop
# -- Backend # -- Backend

28
compose-e2e.yml Normal file
View File

@@ -0,0 +1,28 @@
services:
frontend:
user: "${DOCKER_USER:-1000}"
build:
context: .
dockerfile: ./src/frontend/Dockerfile
target: frontend-production
args:
API_ORIGIN: "http://localhost:8071"
PUBLISH_AS_MIT: "false"
SW_DEACTIVATED: "true"
image: impress:frontend-production
ports:
- "3000:3000"
y-provider:
user: ${DOCKER_USER:-1000}
build:
context: .
dockerfile: ./src/frontend/servers/y-provider/Dockerfile
target: y-provider
image: impress:y-provider-production
restart: unless-stopped
env_file:
- env.d/development/common
ports:
- "4444:4444"

View File

@@ -107,8 +107,6 @@ services:
depends_on: depends_on:
app-dev: app-dev:
condition: service_started condition: service_started
y-provider:
condition: service_started
keycloak: keycloak:
condition: service_healthy condition: service_healthy
restart: true restart: true
@@ -148,7 +146,7 @@ services:
volumes: volumes:
- ".:/app" - ".:/app"
y-provider: y-provider-development:
user: ${DOCKER_USER:-1000} user: ${DOCKER_USER:-1000}
build: build:
context: . context: .