Add CD
This commit is contained in:
parent
fb044bc122
commit
ba050930ba
7 changed files with 169 additions and 16 deletions
51
.github/workflows/main.yaml
vendored
Normal file
51
.github/workflows/main.yaml
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
name: Deploy everything
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
env:
|
||||
CONTAINER_REGISTRY: schmelczera
|
||||
DOMAIN: '161.35.71.163'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout current branch with lfs
|
||||
uses: actions/checkout@main
|
||||
with:
|
||||
lfs: true
|
||||
|
||||
- name: Setup auth tokens
|
||||
run: |
|
||||
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push
|
||||
run: |
|
||||
docker build . -t $CONTAINER_REGISTRY/timeline
|
||||
docker push $CONTAINER_REGISTRY/timeline
|
||||
|
||||
push:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-frontend
|
||||
- build-ingress
|
||||
steps:
|
||||
- name: Checkout current branch with lfs
|
||||
uses: actions/checkout@main
|
||||
with:
|
||||
lfs: true
|
||||
|
||||
- name: Setup auth tokens
|
||||
run: |
|
||||
# SSH key
|
||||
mkdir ~/.ssh
|
||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
|
||||
chmod 400 ~/.ssh/id_ed25519
|
||||
ssh -o StrictHostKeyChecking=no root@$DOMAIN uptime
|
||||
|
||||
- name: Stack up
|
||||
run: |
|
||||
DOCKER_HOST=ssh://root@$DOMAIN docker login -u ${{ secrets.DOCKER_TOKEN }} -p ${{ secrets.DOCKER_TOKEN }} $CONTAINER_REGISTRY
|
||||
DOCKER_HOST=ssh://root@$DOMAIN docker stack up declared -c docker-compose.yml --with-registry-auth
|
||||
working-directory: infrastructure
|
||||
Loading…
Add table
Add a link
Reference in a new issue