Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions .github/workflows/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Run lint
- name: Build node-tools image
run: docker build -t node-tools -f Dockerfile.tools .

- name: Install dependencies and run lint
run: |
docker compose -f ${{ env.COMPOSE_FILE_TOOLS }} run --rm install-node-deps
docker compose -f ${{ env.COMPOSE_FILE_TOOLS }} run --rm biome-check

- name: Cleanup dangling volumes
run: docker volume rm $(docker volume ls -q -f dangling=true) || true

typecheck:
runs-on: ubuntu-latest

Expand All @@ -42,9 +47,11 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Run typecheck
- name: Build node-tools image
run: docker build -t node-tools -f Dockerfile.tools .

- name: Install dependencies and run typecheck
run: |
docker compose -f ${{ env.COMPOSE_FILE_TOOLS }} run --rm install-node-deps
docker compose -f ${{ env.COMPOSE_FILE_TOOLS }} run --rm tsc

tests:
Expand All @@ -60,10 +67,15 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build node-tools image
run: docker build -t node-tools -f Dockerfile.tools .

- name: Run tests
run: |
cp .env.ci .env
docker compose -f ${{ env.COMPOSE_FILE }} up -d redis
docker compose -f ${{ env.COMPOSE_FILE_TOOLS }} run --rm install-node-deps
docker compose -f ${{ env.COMPOSE_FILE_TOOLS }} up -d postgres-test
docker compose -f ${{ env.COMPOSE_FILE_TOOLS }} run --rm test

- name: Cleanup dangling volumes
run: docker volume rm $(docker volume ls -q -f dangling=true) || true
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
FROM node:23.0 AS base

# All deps stage
RUN npm install -g corepack@latest && corepack enable

# Dependency stage
FROM base AS deps
WORKDIR /app
ADD package.json pnpm-lock.yaml ./
RUN npm install -g corepack@latest
RUN corepack enable
RUN pnpm install
# Active le cache PNPM pour accélérer les builds
RUN --mount=type=cache,target=/root/.pnpm-store pnpm install

# Production only deps stage
FROM base AS production-deps
WORKDIR /app
ADD package.json pnpm-lock.yaml ./
RUN npm install -g corepack@latest
RUN corepack enable
RUN pnpm install --frozen-lockfile --prod
RUN --mount=type=cache,target=/root/.pnpm-store pnpm install --frozen-lockfile --prod

# Build stage
FROM base AS build
Expand Down
9 changes: 9 additions & 0 deletions Dockerfile.tools
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:23.0

RUN npm install -g pnpm

WORKDIR /app

COPY package.json pnpm-lock.yaml ./

RUN --mount=type=cache,target=/root/.pnpm-store pnpm install
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,26 +70,26 @@ db-test:
$(DOCKER_COMPOSE_TOOLS) up -d postgres-test

.PHONY: test
test: set-docker-node-deps db-test
test: db-test
$(DOCKER_COMPOSE_TOOLS) run --rm test && $(DOCKER_COMPOSE_TOOLS) down postgres-test

.PHONY: lint
lint: set-docker-node-deps
lint:
$(DOCKER_COMPOSE_TOOLS) run --rm biome-check

.PHONY: lint-fix
lint-fix: set-docker-node-deps
lint-fix:
$(DOCKER_COMPOSE_TOOLS) run --rm biome-check-fix

.PHONY: tsc
tsc:
$(DOCKER_COMPOSE_TOOLS) run --rm tsc

.PHONY: init-dev
init-dev: install docker-dev migrate seed serve
init-dev: docker-dev migrate seed serve

.PHONY: init-prod
init-prod: install docker-prod migrate
init-prod: docker-prod migrate

.PHONY: reset-db
reset-db: rollback migrate seed
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ services:
volumes:
- .:/app
- node_modules:/app/node_modules
- pnpm-store:/root/.pnpm-store
environment:
- REDIS_HOST=redis
- DB_HOST=postgres
working_dir: /app
entrypoint: [ "sh", "-c" ]
command: ["corepack enable && node ace scheduler:run"]
command: ["node ace scheduler:run"]
depends_on:
- redis

Expand All @@ -27,3 +28,4 @@ services:

volumes:
node_modules:
pnpm-store:
33 changes: 19 additions & 14 deletions docker-compose.tools.yaml
Original file line number Diff line number Diff line change
@@ -1,55 +1,61 @@
services:
install-node-deps:
image: node:23.0
image: node-tools
volumes:
- .:/app
- node_modules:/app/node_modules
- pnpm-store:/root/.pnpm-store
entrypoint: [ "sh", "-c" ]
command: ["npm install -g corepack@latest && corepack enable && pnpm install"]
command: ["npm install -g pnpm && pnpm install"]
working_dir: /app

tsc:
image: node:23.0
image: node-tools
volumes:
- .:/app
- node_modules:/app/node_modules
- pnpm-store:/root/.pnpm-store
working_dir: /app
entrypoint: [ "sh", "-c" ]
command: ["npm install -g corepack@latest && corepack enable && FORCE_COLOR=1 pnpm typecheck"]
command: ["pnpm typecheck"]

biome-check:
image: node:23.0
image: node-tools
volumes:
- .:/app
- node_modules:/app/node_modules
- pnpm-store:/root/.pnpm-store
working_dir: /app
entrypoint: [ "sh", "-c" ]
command: ["npm install -g corepack@latest && corepack enable && FORCE_COLOR=1 pnpm lint"]
command: ["pnpm lint"]

biome-check-fix:
image: node:23.0
image: node-tools
volumes:
- .:/app
- node_modules:/app/node_modules
- pnpm-store:/root/.pnpm-store
working_dir: /app
entrypoint: [ "sh", "-c" ]
command: ["npm install -g corepack@latest && corepack enable && FORCE_COLOR=1 pnpm lint --write"]
command: ["pnpm lint --write"]

build:
image: node:23.0
image: node-tools
volumes:
- .:/app
- node_modules:/app/node_modules
- pnpm-store:/root/.pnpm-store
- build:/app/build
working_dir: /app
entrypoint: [ "sh", "-c" ]
command: ["npm install -g corepack@latest && corepack enable && FORCE_COLOR=1 pnpm build"]
command: ["pnpm build"]

test:
image: node:23.0
image: node-tools
volumes:
- .:/app
- node_modules:/app/node_modules
- pnpm-store:/root/.pnpm-store
working_dir: /app
environment:
- REDIS_HOST=redis
Expand All @@ -60,9 +66,7 @@ services:
- DB_PORT=7357
entrypoint: [ "sh", "-c" ]
command: ["
npm install -g corepack@latest
&& corepack enable
&& pnpm install
pnpm install
&& npx playwright install chromium
&& npx playwright install-deps
&& node ace test browser --force-exit
Expand All @@ -83,4 +87,5 @@ services:

volumes:
node_modules:
pnpm-store:
build: