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.

No related merge requests found
Showing with 18 additions and 10 deletions
+18 -10
default: default:
tags: [docker]
image: node:14
retry: 2 retry: 2
interruptible: true interruptible: true
stages: stages:
- test - test
- build
- deploy - deploy
lint: lint:
stage: test stage: test
tags: [docker]
image: node:12-buster-slim
variables: variables:
NPM_CONFIG_CACHE: "$CI_PROJECT_DIR/.npm" NPM_CONFIG_CACHE: "$CI_PROJECT_DIR/.npm"
before_script: before_script:
...@@ -18,23 +19,30 @@ lint: ...@@ -18,23 +19,30 @@ lint:
- npm install - npm install
script: script:
- npm run lint - npm run lint
artifacts:
name: node_modules
expire_in: 1 day
paths:
- node_modules/
cache: cache:
key: "$CI_COMMIT_REF_NAME-$CI_JOB_NAME" key: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
paths: paths:
- "$NPM_CONFIG_CACHE" - "$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: pages:
stage: deploy stage: deploy
needs: [lint] tags: [dind]
rules: rules:
- if: $CI_COMMIT_BRANCH == "master" - if: $CI_COMMIT_BRANCH == "master"
variables:
- IMAGE: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
script: script:
- npm run build - docker run --rm -v "$PWD/src:/src/ro" -v "$PWD/public:/public" "$IMAGE" build
artifacts: artifacts:
name: pages name: pages
paths: paths:
......
Supports Markdown
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