From 487fdd7a5ca3eb30acbf2e23ddbe505c49142c0e Mon Sep 17 00:00:00 2001 From: litalmason <142991359+litalmason@users.noreply.github.com> Date: Tue, 30 Jan 2024 18:33:50 +0200 Subject: [PATCH 1/5] Create static.yml --- .github/workflows/static.yml | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/static.yml diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml new file mode 100644 index 00000000..d8aee46c --- /dev/null +++ b/.github/workflows/static.yml @@ -0,0 +1,43 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy static content to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + # Upload entire repository + path: './portal' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From 06b2d970ebba0bf66b3242b1cc3a902c1bcb0ae1 Mon Sep 17 00:00:00 2001 From: litalmason <142991359+litalmason@users.noreply.github.com> Date: Tue, 30 Jan 2024 18:41:50 +0200 Subject: [PATCH 2/5] Create docker-image.yml --- .github/workflows/docker-image.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 00000000..c0e3cec5 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,19 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Build the Docker image + run: | + REPO_NAME=$(echo $GITHUB_REPOSITORY | tr '/' '-') + docker build ./portal --file ./portal/Dockerfile --tag $REPO_NAME:$(date +%s) From ec4a261c20ed0987193d165c56e555f02cea1730 Mon Sep 17 00:00:00 2001 From: litalmason <142991359+litalmason@users.noreply.github.com> Date: Tue, 30 Jan 2024 18:42:04 +0200 Subject: [PATCH 3/5] Delete .github/workflows/static.yml --- .github/workflows/static.yml | 43 ------------------------------------ 1 file changed, 43 deletions(-) delete mode 100644 .github/workflows/static.yml diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml deleted file mode 100644 index d8aee46c..00000000 --- a/.github/workflows/static.yml +++ /dev/null @@ -1,43 +0,0 @@ -# Simple workflow for deploying static content to GitHub Pages -name: Deploy static content to Pages - -on: - # Runs on pushes targeting the default branch - push: - branches: ["main"] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - -jobs: - # Single deploy job since we're just deploying - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Pages - uses: actions/configure-pages@v4 - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - # Upload entire repository - path: './portal' - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 From db0273fbfca18d91161cb06bb9fa9ffa89d83173 Mon Sep 17 00:00:00 2001 From: litalmason <142991359+litalmason@users.noreply.github.com> Date: Tue, 30 Jan 2024 18:49:56 +0200 Subject: [PATCH 4/5] Update docker-image.yml --- .github/workflows/docker-image.yml | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index c0e3cec5..f6f3e62e 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,4 +1,4 @@ -name: Docker Image CI +name: Deploy to GitHub Pages on: push: @@ -7,13 +7,28 @@ on: branches: [ "main" ] jobs: - build: + build-and-deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v2 - - name: Build the Docker image - run: | - REPO_NAME=$(echo $GITHUB_REPOSITORY | tr '/' '-') - docker build ./portal --file ./portal/Dockerfile --tag $REPO_NAME:$(date +%s) + # Build your Docker image + - name: Build Docker image + run: docker build ./portal --file ./portal/Dockerfile --tag my-image + + # Run the Docker container and generate static content + # This step assumes your Docker container outputs static files to /usr/share/nginx/html + # Adjust the command according to how your container serves static content + - name: Run Docker container + run: docker run --name my-container my-image + + - name: Copy static content from Docker container + run: docker cp my-container:/usr/share/nginx/html ./static-content + + # Deploy to GitHub Pages + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./static-content From b1b57a2f9e3e6b9b2a2f3d4b1b437964368f999e Mon Sep 17 00:00:00 2001 From: litalmason <142991359+litalmason@users.noreply.github.com> Date: Tue, 30 Jan 2024 18:59:58 +0200 Subject: [PATCH 5/5] Update docker-image.yml --- .github/workflows/docker-image.yml | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index f6f3e62e..6213c8f2 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,4 +1,4 @@ -name: Deploy to GitHub Pages +name: Build and Deploy to GitHub Pages on: push: @@ -11,24 +11,30 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout code + uses: actions/checkout@v2 - # Build your Docker image - name: Build Docker image - run: docker build ./portal --file ./portal/Dockerfile --tag my-image + run: docker build ./portal --file ./portal/Dockerfile --tag my-website-image - # Run the Docker container and generate static content - # This step assumes your Docker container outputs static files to /usr/share/nginx/html - # Adjust the command according to how your container serves static content - name: Run Docker container - run: docker run --name my-container my-image + 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: docker cp my-container:/usr/share/nginx/html ./static-content + 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 - # Deploy to GitHub Pages - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./static-content + publish_dir: ./static-content/qujata