<NME> .gitlab-ci.yml
<BEF> cache:
  key: "${CI_BUILD_REF_NAME} node:8-alpine"
  paths:
  - node_modules/

stages:
  - test
  - release
  - deploy

test:
before_script:
  - npm install

test:
  stage: test
  script:
    - npm run build
    - npm run mocha

build:
  stage: build
  script:
    - npm run build

deploy:
  before_script:
    - apk add --update python py-pip python-dev && pip install docker-compose # install docker-compose
    - docker version
    - docker-compose version
  stage: deploy
  script:
    - npm run build
    - npm run docker

variables:
    - docker:dind
  variables:
    DOCKER_DRIVER: "overlay"

  before_script:
    - docker version
    - "docker info"
    - "docker login -u $CI_REGISTRY_USER -p $CI_BUILD_TOKEN $CI_REGISTRY"
  script:
    - "docker build -t ${CI_REGISTRY}/${CI_PROJECT_PATH}:latest -f Dockerfile-production ."
    - "docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}:latest"
  after_script:
    - "docker logout ${CI_REGISTRY}"

deploy:
  stage: deploy
  image: gitlab/dind:latest
  only:
    - "feathers-2"
    - "master"
  environment: production
  services:
    - docker:dind
  before_script:
    - mkdir -p ~/.ssh
    - echo "$DEPLOY_SERVER_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
    - chmod 600 ~/.ssh/id_rsa
    - eval "$(ssh-agent -s)"
    - ssh-add ~/.ssh/id_rsa
    - ssh-keyscan -H $DEPLOY_SERVER_IP >> ~/.ssh/known_hosts
  script:
    - printf "DATABASE_URL=${DATABASE_URL}\nPORT=80\nGMAIL=$GMAIL\nGMAIL_PASSWORD=$GMAIL_PASSWORD\nFEATHERS_AUTH_SECRET=$FEATHERS_AUTH_SECRET" > environment.env

    - printf "LETS_ENCRYPT_EMAIL=${LETS_ENCRYPT_EMAIL}\nLETS_ENCRYPT_DOMAIN=${LETS_ENCRYPT_DOMAIN}" > .env

    - scp -r environment.env .env production.yml root@${DEPLOY_SERVER_IP}:~/

    - ssh root@$DEPLOY_SERVER_IP "docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}; env $(cat .env | grep ^[A-Z] | xargs) docker stack deploy -c production.yml --with-registry-auth $STACK_NAME"
<MSG> Adds artifacts and remove docker command.

<DFF> @@ -12,25 +12,27 @@ cache:
 before_script:
   - npm install
 
-test:
-  stage: test
-  script:
-    - npm run build
-    - npm run mocha
-
 build:
   stage: build
   script:
     - npm run build
+  artifacts:
+    paths:
+     - server/
+     - public/
+
+test:
+  stage: test
+  script:
+    - npm run mocha
 
 deploy:
   before_script:
     - apk add --update python py-pip python-dev && pip install docker-compose # install docker-compose
-    - docker version
+    # - docker version
     - docker-compose version
   stage: deploy
   script:
-    - npm run build
     - npm run docker
 
 variables:

{'addition_count': 10, 'commit_subject': 'Adds artifacts and remove docker command.', 'deletion_count': 8, 'file_extension': '.yml', 'lang': 'gitlab-ci', 'license': 'mit', 'repo_name': 'codingfriend1/Feathers-Vue'}