Update deploy-dev.yml #3
This file contains 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: Deploy to Development | |
| # Trigger on every push to the main branch | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: self-hosted | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v3 | |
| - name: Build Docker Image for Frontend | |
| run: | | |
| # Build the Docker image using the Dockerfile in the frontend folder. | |
| # The dot at the end sets the build context to the repository root. | |
| docker build -t myapp:latest -f frontend/Dockerfile . | |
| - name: Stop and Remove Existing Container | |
| run: | | |
| # Stop and remove the existing container if it's running. | |
| docker rm -f myapp_container || true | |
| - name: Run New Container | |
| run: | | |
| # Run the updated container in detached mode. | |
| # Adjust port mapping if your container listens on a different port. | |
| docker run -d --name myapp_container -p 80:3000 myapp:latest | |
| - name: Verify Deployment | |
| run: docker ps |