Feature: Deploy Docker container after it is created
This commit is contained in:
parent
c77064b5b9
commit
cdb02eb5dd
|
@ -35,8 +35,8 @@ jobs:
|
||||||
name: build
|
name: build
|
||||||
path: target/x86_64-unknown-linux-gnu/release/automation
|
path: target/x86_64-unknown-linux-gnu/release/automation
|
||||||
|
|
||||||
create-docker-container:
|
container:
|
||||||
name: Create Docker container
|
name: Create container
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build]
|
needs: [build]
|
||||||
container: catthehacker/ubuntu:act-latest
|
container: catthehacker/ubuntu:act-latest
|
||||||
|
@ -67,3 +67,35 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: git.huizinga.dev/dreaded_x/automation_rs:latest
|
tags: git.huizinga.dev/dreaded_x/automation_rs:latest
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
name: Deploy Docker container
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: catthehacker/ubuntu:act-latest
|
||||||
|
needs: [container]
|
||||||
|
if: gitea.ref == 'refs/heads/master'
|
||||||
|
steps:
|
||||||
|
- name: Stop and remove current container
|
||||||
|
run: |
|
||||||
|
docker stop automation_rs || true
|
||||||
|
docker rm automation_rs || true
|
||||||
|
|
||||||
|
- name: Create container
|
||||||
|
run: |
|
||||||
|
docker create \
|
||||||
|
--pull always \
|
||||||
|
--restart unless-stopped \
|
||||||
|
--name automation_rs \
|
||||||
|
-e RUST_LOG=automation=debug \
|
||||||
|
-e MQTT_PASSWORD=${{ secrets.MQTT_PASSWORD }} \
|
||||||
|
-e HUE_TOKEN=${{ secrets.HUE_TOKEN }} \
|
||||||
|
-e NTFY_TOPIC=${{ secrets.NTFY_TOPIC }} \
|
||||||
|
git.huizinga.dev/dreaded_x/automation_rs:latest
|
||||||
|
|
||||||
|
docker network connect mqtt automation_rs
|
||||||
|
docker network connect web automation_rs
|
||||||
|
|
||||||
|
- name: Start container
|
||||||
|
run: docker start automation_rs
|
||||||
|
|
||||||
|
# TODO: Perform a healthcheck
|
||||||
|
|
Loading…
Reference in New Issue
Block a user