I have a GitHub action CI CD that checks out code and runs docker-compose.yml. In the log, I can see it starting both the containers but when I ssh into the system and do a docker ps, do not see any containers.
Here is my GitHub action -
name: CI
on:
push:
branches: [master]
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout files
uses: actions/checkout@v2
deploy:
needs: build_and_push
runs-on: ubuntu-latest
steps:
- name: Checkout files
uses: actions/checkout@v2
- name: Deploy to Digital Ocean droplet via SSH action
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
- name: Start containers
run: docker-compose up -d --build
- name: Dump docker logs
uses: jwalton/gh-docker-logs@v1
Please suggest how should I troubleshoot this. Thanks!
The appleboy/ssh-action
actions explains how to run commands on the remote server: By using the script
attribute.
In your case:
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout files
uses: actions/checkout@v2
deploy:
needs: build_and_push
runs-on: ubuntu-latest
steps:
- name: Checkout files
uses: actions/checkout@v2
- name: Deploy to Digital Ocean droplet via SSH action
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: | <=====
docker-compose up -d --build <=====
- name: Dump docker logs
uses: jwalton/gh-docker-logs@v1