Update main.yaml to adapt a more mature deployment model
This commit is contained in:
parent
58e688b83e
commit
2587d54bf6
1 changed files with 24 additions and 18 deletions
42
.github/workflows/main.yaml
vendored
42
.github/workflows/main.yaml
vendored
|
|
@ -12,25 +12,31 @@ jobs:
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@master
|
||||||
with:
|
with:
|
||||||
lfs: true
|
lfs: true
|
||||||
|
|
||||||
- name: Build frontend
|
|
||||||
run: |
|
|
||||||
docker build . -t declared-frontend
|
|
||||||
docker save -o declared-frontend.image declared-frontend
|
|
||||||
working-directory: frontend
|
|
||||||
|
|
||||||
- name: Create id file
|
- name: Setup auth tokens
|
||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > id
|
# SSH key
|
||||||
chmod 700 id
|
mkdir ~/.ssh
|
||||||
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
|
||||||
- name: Push artifacts
|
chmod 400 ~/.ssh/id_ed25519
|
||||||
run: |
|
ssh -o StrictHostKeyChecking=no root@decla.red uptime
|
||||||
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
|
# Docker Hub
|
||||||
|
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push ingress
|
||||||
run: |
|
run: |
|
||||||
ssh -i id -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@decla.red 'docker load < /root/images/declared-frontend.image && \
|
docker build . -t schmelczera/declared-ingress
|
||||||
cd /root/infra && docker-compose up -d'
|
docker push schmelczera/declared-ingress
|
||||||
rm id
|
working-directory: ingress
|
||||||
|
|
||||||
|
- name: Build and push frontend
|
||||||
|
run: |
|
||||||
|
docker build . -t schmelczera/declared-frontend
|
||||||
|
docker push schmelczera/declared-frontend
|
||||||
|
working-directory: frontend
|
||||||
|
|
||||||
|
- name: Deploy
|
||||||
|
run: |
|
||||||
|
DOCKER_HOST=ssh://root@decla.red docker stack up declared -c docker-compose.yml
|
||||||
|
working-directory: infrastructure
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue