diff --git a/.circleci/config.yml b/.circleci/config.yml index edff10a..c8206f4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,67 +1,17 @@ version: 2.1 -jobs: - build: - parameters: - build-domain: - type: string - ssh-port: - type: integer - environment: - COMPOSE_PROJECT_NAME: lucos_private - BUILD_DOMAIN: << parameters.build-domain >> - SSH_PORT: << parameters.ssh-port >> - docker: - - image: circleci/buildpack-deps:buster - steps: - - run: - name: Check BUILD_DOMAIN - command: echo "Building on host \"$BUILD_DOMAIN\"" - - add_ssh_keys: - fingerprints: - - "3b:d2:84:bc:c8:2e:09:b7:2f:e7:50:23:46:41:cf:23" - - run: - name: Populate known_hosts - command: ssh-keyscan -p $SSH_PORT -H $BUILD_DOMAIN >> ~/.ssh/known_hosts - - run: - name: Remote build - command: ssh $DEPLOY_USERNAME@$BUILD_DOMAIN -o "StrictHostKeyChecking no" -A -p $SSH_PORT CIRCLE_REPOSITORY_URL=$CIRCLE_REPOSITORY_URL DOCKERHUB_USERNAME=$DOCKERHUB_USERNAME DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD quickbuild.sh - deploy: - parameters: - host-domain: - type: string - environment: - COMPOSE_PROJECT_NAME: lucos_private - PRODUCTION: true - HOSTDOMAIN: << parameters.host-domain >> - docker: - - image: circleci/buildpack-deps:buster - steps: - - run: - name: Check HOSTDOMAIN - command: echo "Deploying onto host \"$HOSTDOMAIN\"" - - checkout - - add_ssh_keys: - fingerprints: - - "3b:d2:84:bc:c8:2e:09:b7:2f:e7:50:23:46:41:cf:23" - - run: - name: Populate known_hosts - command: ssh-keyscan -H $HOSTDOMAIN >> ~/.ssh/known_hosts - - run: - name: Pull container onto remote box - command: DOCKER_HOST="ssh://$DEPLOY_USERNAME@$HOSTDOMAIN" docker-compose pull - - run: - name: Deploy using docker-compose - command: DOCKER_HOST="ssh://$DEPLOY_USERNAME@$HOSTDOMAIN" docker-compose up -d --no-build +orbs: + lucos: lucos/deploy@0 workflows: version: 2 build-deploy: jobs: - - build: + - lucos/build-arm: context: docker - build-domain: xwing.s.l42.eu - ssh-port: 2222 - - deploy: + - lucos/deploy-xwing: context: docker - host-domain: xwing.s.l42.eu requires: - - build \ No newline at end of file + - lucos/build-arm + filters: + branches: + only: + - main \ No newline at end of file