You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor Dockerfile and Makefile for improved build process and testing
- Transitioned to a multi-stage Dockerfile using Alpine for a more efficient build.
- Added build arguments for versioning and Git metadata.
- Updated Makefile to include a dedicated test image and streamline build commands.
- Enhanced Playwright configuration to utilize system Chromium in tests.
- Revised GitHub Actions workflows for better dependency management and testing flow.
These changes optimize the development and testing workflow, ensuring a cleaner and more efficient build process.
Copy file name to clipboardExpand all lines: Dockerfile
+49-24Lines changed: 49 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -1,39 +1,64 @@
1
-
FROM node:22-bookworm-slim
1
+
# Multi-stage Alpine (même esprit que sesame-orchestrator) : build isolé, runtime avec node_modules complet pour `start.mjs` (rebuild si `.env` change).
2
+
FROM node:22-alpine AS builder
3
+
4
+
WORKDIR /data
5
+
6
+
RUN apk add --no-cache git
7
+
8
+
COPY package.json yarn.lock ./
9
+
10
+
RUN yarn install \
11
+
--prefer-offline \
12
+
--frozen-lockfile \
13
+
--non-interactive \
14
+
--production=false
15
+
16
+
COPY . .
17
+
18
+
RUN yarn build
19
+
20
+
FROM node:22-alpine AS production
2
21
3
22
ARG NODE_ENV=production
23
+
ARG BUILD_VERSION=dev
24
+
ARG GIT_BRANCH=unknown
25
+
ARG GIT_COMMIT=unknown
26
+
ARG DOCKER_TAG=unknown
27
+
4
28
ENV NODE_ENV=${NODE_ENV}
5
-
ENV NODE_OPTIONS=--openssl-legacy-provider
29
+
ENV BUILD_VERSION=${BUILD_VERSION}
30
+
ENV GIT_BRANCH=${GIT_BRANCH}
31
+
ENV GIT_COMMIT=${GIT_COMMIT}
32
+
ENV DOCKER_TAG=${DOCKER_TAG}
33
+
ENV DO_NOT_TRACK=1
34
+
ENV TZ=Europe/Paris
6
35
7
36
WORKDIR /data
8
37
9
-
# Install dependencies. Note that the package names and the package manager are different for Debian-based images.
# Volume dédié : évite de monter les node_modules du mac dans le conteneur Linux.
11
12
# Réseau Docker « dev » : créer une fois (make network-dev ou docker network create dev).
12
-
# Flux : pas de yarn sur le Mac — make exec puis yarn install ; e2e / CI : docker dans .github/workflows/lint.yml.
13
-
# Chaque « make test » / « verify » : nouveau conteneur → yarn playwright:install-deps puis tests (prérequis : node_modules + cache Playwright remplis, ex. étapes du workflow ou exec).
13
+
# Flux : pas de yarn sur le Mac — make exec puis yarn install ; PR : .github/workflows/lint.yml ; push main (chemins filtrés) : docker-image.yml ; tests e2e locaux : make build && make test (image test basée sur $(IMG_NAME)).
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# sesame-gestion-mdp
2
2
Gestion des mot de passe sesame
3
3
4
-
Les commandes **yarn** (install, test, build, etc.) se font dans **Docker** : `make build` puis `make exec`, puis par exemple `yarn install` et `yarn playwright:install` dans le shell du conteneur. Sur la CI, **`make ci-github`**enchaîne tout sans yarn sur le runner.
4
+
Les commandes **yarn** (install, build, etc.) se font dans **Docker** : `make build` puis `make exec`, puis par exemple `yarn install`. Les **e2e** passent par **`make test`** (image `Dockerfile.test`, Chromium système Alpine, sans `apt-get`). Sur GitHub, le workflow **`.github/workflows/lint.yml`**construit l’image app + image de test puis exécute `yarn ci` dans l’image de test.
0 commit comments