Skip to content

add github actions and Dockerfile for deployment #4

add github actions and Dockerfile for deployment

add github actions and Dockerfile for deployment #4

Workflow file for this run

name: Deploy
on:
push:
branches: [main]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/#-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_APP_NAME }}:latest
- name: Deploy to server (replace with your deployment steps)
uses: ssh-actions/deploy@v2
with:
host: ${{ secrets.SERVER_HOST }}
user: ${{ secrets.SERVER_USERNAME }}
privateKey: ${{ secrets.SERVER_SSH_KEY }}
commands:
- docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_APP_NAME }}:latest

Check failure on line 32 in .github/workflows/deploy.yml

View workflow run for this annotation

GitHub Actions / Deploy

Invalid workflow file

The workflow is not valid. .github/workflows/deploy.yml (Line: 32, Col: 13): A sequence was not expected
- docker stop your-app-container || true
- docker rm your-app-container || true
- docker run -d -p 8080:8080 --name your-app-container ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_APP_NAME }}:latest