From f440ae623d02874d7e9c942eb32577775c34f724 Mon Sep 17 00:00:00 2001 From: Sourov Jajodia <46421338+Sourov72@users.noreply.github.com> Date: Thu, 17 Jul 2025 16:01:31 -0400 Subject: [PATCH 1/5] Create Dockerfile --- .../Headless-Google-Chrome/Dockerfile | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 docker-modules/Headless-Google-Chrome/Dockerfile diff --git a/docker-modules/Headless-Google-Chrome/Dockerfile b/docker-modules/Headless-Google-Chrome/Dockerfile new file mode 100644 index 0000000..3cb280b --- /dev/null +++ b/docker-modules/Headless-Google-Chrome/Dockerfile @@ -0,0 +1,43 @@ +# Dockerfile +FROM debian:bullseye + +# Install system dependencies, including ca-certificates +RUN apt-get update && apt-get install -y \ + wget \ + curl \ + gnupg \ + ca-certificates \ + unzip \ + fonts-liberation \ + libappindicator3-1 \ + libasound2 \ + libatk-bridge2.0-0 \ + libatk1.0-0 \ + libcups2 \ + libdbus-1-3 \ + libgdk-pixbuf2.0-0 \ + libnspr4 \ + libnss3 \ + libx11-xcb1 \ + libxcomposite1 \ + libxdamage1 \ + libxrandr2 \ + xdg-utils \ + --no-install-recommends && \ + rm -rf /var/lib/apt/lists/* + +# Install Google Chrome +RUN apt-get update && \ + curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/google-linux-keyring.gpg && \ + echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-linux-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list && \ + apt-get update && apt-get install -y google-chrome-stable && \ + rm -rf /var/lib/apt/lists/* + +# Create non-root user +RUN useradd -m chromeuser + +# Switch to non-root user +USER chromeuser + +# Set Chrome as entrypoint with headless configuration +ENTRYPOINT ["google-chrome", "--headless", "--no-sandbox", "--disable-gpu", "--remote-debugging-port=9222", "--disable-dev-shm-usage"] From 734a92baaa3c2fd736237cf1c52a9451f9ec9d91 Mon Sep 17 00:00:00 2001 From: Sourov Jajodia <46421338+Sourov72@users.noreply.github.com> Date: Thu, 17 Jul 2025 16:02:35 -0400 Subject: [PATCH 2/5] Create Github-action-workflow.yml --- .../Github-action-workflow.yml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 docker-modules/Headless-Google-Chrome/Github-action-workflow.yml diff --git a/docker-modules/Headless-Google-Chrome/Github-action-workflow.yml b/docker-modules/Headless-Google-Chrome/Github-action-workflow.yml new file mode 100644 index 0000000..5fc79e5 --- /dev/null +++ b/docker-modules/Headless-Google-Chrome/Github-action-workflow.yml @@ -0,0 +1,36 @@ +# .github/workflows/chrome-test.yml +name: Run Chrome Headless Test + +on: [push] + +jobs: + headless-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker + run: sudo apt-get update && sudo apt-get install -y docker.io + + - name: Build Chrome Docker image + run: docker build -t headless-chrome . + + - name: Run screenshot test + run: | + mkdir screenshots + docker run --rm \ + -v ${{ github.workspace }}/screenshots:/screenshots \ + headless-chrome \ + --headless \ + --disable-gpu \ + --no-sandbox \ + --screenshot=/screenshots/test.png \ + https://google.com + + - name: Upload screenshot artifact + uses: actions/upload-artifact@v3 + with: + name: screenshot + path: screenshots/test.png From 1d4cca6cd51cc4344af7e4776dd3f368163c1208 Mon Sep 17 00:00:00 2001 From: Sourov Jajodia <46421338+Sourov72@users.noreply.github.com> Date: Wed, 30 Jul 2025 01:38:08 -0400 Subject: [PATCH 3/5] Rename Dockerfile to Dockerfile --- .../{Headless-Google-Chrome => headless-google-chrome}/Dockerfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docker-modules/{Headless-Google-Chrome => headless-google-chrome}/Dockerfile (100%) diff --git a/docker-modules/Headless-Google-Chrome/Dockerfile b/docker-modules/headless-google-chrome/Dockerfile similarity index 100% rename from docker-modules/Headless-Google-Chrome/Dockerfile rename to docker-modules/headless-google-chrome/Dockerfile From 02f24d07eddc1a6d7f5b65562aa0d8640a4dcd0f Mon Sep 17 00:00:00 2001 From: Sourov Jajodia <46421338+Sourov72@users.noreply.github.com> Date: Wed, 30 Jul 2025 01:38:47 -0400 Subject: [PATCH 4/5] Rename Github-action-workflow.yml to Ggithub-action-workflow.yml --- .../Ggithub-action-workflow.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docker-modules/{Headless-Google-Chrome/Github-action-workflow.yml => headless-google-chrome/Ggithub-action-workflow.yml} (100%) diff --git a/docker-modules/Headless-Google-Chrome/Github-action-workflow.yml b/docker-modules/headless-google-chrome/Ggithub-action-workflow.yml similarity index 100% rename from docker-modules/Headless-Google-Chrome/Github-action-workflow.yml rename to docker-modules/headless-google-chrome/Ggithub-action-workflow.yml From 243d7641a3cdab514cd6fbb485dc01ae6b4793da Mon Sep 17 00:00:00 2001 From: Sourov Jajodia <46421338+Sourov72@users.noreply.github.com> Date: Wed, 30 Jul 2025 01:39:02 -0400 Subject: [PATCH 5/5] Rename Ggithub-action-workflow.yml to github-action-workflow.yml --- .../{Ggithub-action-workflow.yml => github-action-workflow.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docker-modules/headless-google-chrome/{Ggithub-action-workflow.yml => github-action-workflow.yml} (100%) diff --git a/docker-modules/headless-google-chrome/Ggithub-action-workflow.yml b/docker-modules/headless-google-chrome/github-action-workflow.yml similarity index 100% rename from docker-modules/headless-google-chrome/Ggithub-action-workflow.yml rename to docker-modules/headless-google-chrome/github-action-workflow.yml