Olivier Massot hace 7 meses
padre
commit
e4e803096b
Se han modificado 2 ficheros con 44 adiciones y 18 borrados
  1. 30 18
      .gitlab-ci.yml
  2. 14 0
      Dockerfile

+ 30 - 18
.gitlab-ci.yml

@@ -1,39 +1,39 @@
 stages:
+  - build
   - test
-  - qa
+  - analysis
 
 variables:
   APP_ENV: ci
 
-before_script:
-  - echo "" > ./env/local.app.opentalent.fr.crt
-  - echo "" > ./env/local.app.opentalent.fr.key
-  - corepack enable
-  - yarn set version berry
-  - yarn install --network-timeout 10000
-  - HOSTNAME=ci yarn prepare
-
 cache:
   paths:
     - ./node_modules
     - .yarn
+    - yarn.lock
 
-code_quality:
-  stage: qa
+build_image:
+  stage: build
+  image: docker:20.10
+  before_script:
+    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
   script:
-    - yarn eslint
+    - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
+    - docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
+    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
+    - docker push $CI_REGISTRY_IMAGE:latest
 
-code_style:
-  stage: qa
-  script:
-    - yarn prettier . --check
+.default_config: &default_config
+  image: $CI_REGISTRY_IMAGE:latest
+  before_script:
+    - yarn install --network-timeout 10000
+    - HOSTNAME=ci yarn prepare
 
 unit:
+  <<: *default_config
   stage: test
-
   script:
     - yarn test
-
   artifacts:
     paths:
       - ./coverage/
@@ -46,3 +46,15 @@ unit:
 
   # Extract total coverage from job logs (https://docs.gitlab.com/15.6/ee/ci/yaml/index.html#coverage)
   coverage: '/All files\s*|\s*\d+\.\d+/'
+
+code_quality:
+  <<: *default_config
+  stage: analysis
+  script:
+    - yarn eslint
+
+code_style:
+  <<: *default_config
+  stage: analysis
+  script:
+    - yarn prettier . --check

+ 14 - 0
Dockerfile

@@ -0,0 +1,14 @@
+FROM node:23.8.0
+
+ENV WORKDIR /home/workspace
+
+RUN corepack enable; \
+    yarn set version 4.3.1;
+
+RUN echo "" > ./env/local.app.opentalent.fr.crt; \
+    echo "" > ./env/local.app.opentalent.fr.key;
+
+# Define working directory.
+WORKDIR ${WORKDIR}
+
+CMD node