Skip to content

Commit

Permalink
use orb for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas42 committed Dec 11, 2020
1 parent b02d781 commit 038d015
Showing 1 changed file with 9 additions and 59 deletions.
68 changes: 9 additions & 59 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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
- lucos/build-arm
filters:
branches:
only:
- main

0 comments on commit 038d015

Please sign in to comment.