when: branch: main event: [push, manual] steps: - name: build image: docker:cli volumes: - /var/run/docker.sock:/var/run/docker.sock commands: - docker build -t yugioh-api:latest . - name: deploy image: docker:cli volumes: - /var/run/docker.sock:/var/run/docker.sock - /opt/docker/yugioh/.env:/opt/docker/yugioh/.env commands: - sed "s/='\(.*\)'$/=\1/; s/=\"\(.*\)\"$/=\1/" /opt/docker/yugioh/.env > /tmp/yugioh-api.env - docker stop yugioh-api || true - docker rm yugioh-api || true - docker network create yugioh || true - docker run -d --name yugioh-api --restart unless-stopped --network yugioh --env-file /tmp/yugioh-api.env yugioh-api:latest