Fix in config #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker Image CI | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| paths: | |
| - "iot-dashboard/**" | |
| - '.github/workflows/docker-dashboard.yml' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| TIMESTAMP: ${{ github.run_id }} | |
| IMAGE_NAME: iot-dashboard | |
| TS_OAUTH_CLIENT_ID: ${{ secrets.TS_OAUTH_CLIENT_ID }} | |
| TS_OAUTH_SECRET: ${{ secrets.TS_OAUTH_SECRET }} | |
| HOST: ${{ secrets.SSH_HOST }} | |
| NAME: ${{ secrets.SSH_NAME }} | |
| KEY: ${{ secrets.KEY }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Connect Tailscale | |
| uses: tailscale/github-action@v2 | |
| with: | |
| oauth-client-id: $TS_OAUTH_CLIENT_ID | |
| oauth-secret: $TS_OAUTH_SECRET | |
| tags: tag:whispern-ci | |
| - name: Save the SSH key | |
| uses: webfactory/ssh-agent@v0.9.0 | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_KEY }} | |
| - name: Configure SSH (disable host key checking) | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "Host *" > ~/.ssh/config | |
| echo " StrictHostKeyChecking no" >> ~/.ssh/config | |
| echo " UserKnownHostsFile=/dev/null" >> ~/.ssh/config | |
| - name: SCP files to remote | |
| run: | | |
| scp -r ./iot-dashboard nilsj@nilss-mac-mini:/Users/nilsj/Projects/home-iot/deployment/dashboard/ | |
| - name: Execute SSH command on remote | |
| run: | | |
| ssh nilsj@nilss-mac-mini.tailed622e.ts.net 'bash -l -c " | |
| cd /Users/nilsj/Projects/home-iot/deployment/iot-dashboard | |
| docker stop iot-dashboard || true | |
| docker rm iot-dashboard || true | |
| docker build -t iot-dashboard:latest . | |
| docker run -d --name iot-dashboard -p 3000:3000 iot-dashboard:latest"' |