diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 8f8d9a0..2a74c61 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,21 +1,36 @@ -name: Deploy notebooks +name: Deploy everything on: push: branches: - master jobs: - docker-deploy: + deploying: runs-on: ubuntu-latest steps: + - name: Checkout current branch with lfs uses: actions/checkout@master with: lfs: true - - name: Publish notebooks to docker hub - uses: elgohr/Publish-Docker-Github-Action@master - with: - name: schmelczera/declared-frontend - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - dockerfile: frontend/Dockerfile - tags: "latest" + + - name: Build frontend + run: | + docker build . -t declared-frontend + docker save -o declared-frontend.image declared-frontend + working-directory: frontend + + - name: Create id file + run: | + echo "${{ secrets.SSH_PRIVATE_KEY }}" > id + chmod 700 id + + - name: Push artifacts + run: | + scp -i id -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null frontend/declared-frontend.image root@decla.red:/root/images/declared-frontend.image + scp -i id -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r infrastructure root@decla.red:/root/infra + + - name: Compose up + run: | + ssh -i id -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@decla.red 'docker load < /root/images/declared-frontend.image && \ + cd /root/infra && docker-compose up -d' + rm id diff --git a/infrastructure/docker-compose.yml b/infrastructure/docker-compose.yml index 13b10ff..64f6ab9 100644 --- a/infrastructure/docker-compose.yml +++ b/infrastructure/docker-compose.yml @@ -13,7 +13,7 @@ services: - ./data/certbot/conf:/etc/letsencrypt - ./data/certbot/www:/var/www/certbot frontend: - image: schmelczera/declared-frontend + image: declared-frontend restart: unless-stopped certbot: image: certbot/certbot