diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 00000000..6213c8f2 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,40 @@ +name: Build and Deploy to GitHub Pages + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build Docker image + run: docker build ./portal --file ./portal/Dockerfile --tag my-website-image + + - name: Run Docker container + run: | + docker run --name my-website-container -d my-website-image + # Wait a few seconds to ensure the web server inside the container is fully up and running + sleep 10 + + - name: Copy static content from Docker container + run: | + mkdir -p static-content + docker cp my-website-container:/usr/share/nginx/html/qujata ./static-content + + - name: Stop and remove Docker container + run: | + docker stop my-website-container + docker rm my-website-container + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./static-content/qujata