diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9aed573901a369dfdb8f99c8428a689c01576d44..aa20ab27a54c5876e305f9380b5da648df9acab6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,15 +1,16 @@ 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: