Commit 43eef28b authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Tente de construire et d'utiliser une image Docker en CI.

parent 1235a977
default:
tags: [docker]
image: node:14
retry: 2
interruptible: true
stages:
- test
- build
- deploy
lint:
stage: test
tags: [docker]
image: node:12-buster-slim
variables:
NPM_CONFIG_CACHE: "$CI_PROJECT_DIR/.npm"
before_script:
......@@ -18,23 +19,30 @@ lint:
- npm install
script:
- npm run lint
artifacts:
name: node_modules
expire_in: 1 day
paths:
- node_modules/
cache:
key: "$CI_COMMIT_REF_NAME-$CI_JOB_NAME"
key: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
paths:
- "$NPM_CONFIG_CACHE"
docker:
stage: build
tags: [dind]
variables:
- IMAGE: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
script:
- docker build --tag "$IMAGE" .
- docker run --rm "$IMAGE" build
- docker push "$IMAGE"
pages:
stage: deploy
needs: [lint]
tags: [dind]
rules:
- if: $CI_COMMIT_BRANCH == "master"
variables:
- IMAGE: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
script:
- npm run build
- docker run --rm -v "$PWD/src:/src/ro" -v "$PWD/public:/public" "$IMAGE" build
artifacts:
name: pages
paths:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment