diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml new file mode 100644 index 0000000..b3e389d --- /dev/null +++ b/.github/workflows/deploy-dev.yml @@ -0,0 +1,29 @@ +name: Deploy to Development + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: self-hosted + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build Docker image + run: | + # Build the Docker image and tag it with "latest" + docker build -t myapp:latest . + + - name: Stop and remove existing container + run: | + # If there's an existing container, stop and remove it. + docker rm -f myapp_container || true + + - name: Run Docker container + run: | + # Run the new container in detached mode, mapping port 80 + docker run -d --name myapp_container -p 80:80 myapp:latest