Add CD workflow
This commit is contained in:
parent
f3e91c888b
commit
e35c3e5ca7
2 changed files with 26 additions and 11 deletions
35
.github/workflows/main.yaml
vendored
35
.github/workflows/main.yaml
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue