diff --git a/.Dockerignore b/.Dockerignore new file mode 100644 index 0000000..80f121d --- /dev/null +++ b/.Dockerignore @@ -0,0 +1,8 @@ +# Ignore everything +* + +# Allow files and directories +!/requirements.txt +!/pytest.ini +!/paf +!/test diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cf42f22..fd9256a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,9 +36,9 @@ jobs: # uses: actions/setup-python@v3 # with: # python-version: "3.10" - - name: Install dependencies - run: | - pip install -r requirements.txt +# - name: Install dependencies +# run: | +# pip install -r requirements.txt # - name: List chromedriver # run: | # ls -lahF diff --git a/.gitignore b/.gitignore index 5aea575..3ef82f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ build.env +*.iml diff --git a/README.md b/README.md index 8be088e..213c080 100644 --- a/README.md +++ b/README.md @@ -131,12 +131,9 @@ podman push paf-test-base:latest docker://ghcr.io/mreiche/paf-test-base:latest ``` #### Build test runner container (for testing) -```shell -podman build -f test.Dockerfile --arch=amd64 -t paf-test:latest -``` Run tests within container ```shell -podman run -e PAF_TEST_HEADLESS=1 -e PAF_TEST_CONTAINER=1 -e PAF_TEST_LOCAL_SELENIUM=0 paf-test:latest pytest --cov=paf -n=4 test +podman run -e PAF_TEST_HEADLESS=1 -e PAF_TEST_CONTAINER=1 -e PAF_TEST_LOCAL_SELENIUM=0 paf-test-base:latest pytest --cov=paf -n=4 test ``` #### Run local selenium server diff --git a/test.Dockerfile b/test.Dockerfile deleted file mode 100644 index 2e56f8d..0000000 --- a/test.Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM paf-test-base:latest - -COPY requirements.txt . -RUN pip install -r requirements.txt -COPY pytest.ini pytest.ini -COPY test test -COPY paf paf diff --git a/ubuntu-base.Dockerfile b/ubuntu-base.Dockerfile index 3c5e291..6ac615d 100644 --- a/ubuntu-base.Dockerfile +++ b/ubuntu-base.Dockerfile @@ -2,12 +2,10 @@ FROM ubuntu:22.04 WORKDIR /home -# ./chrome-headless-shell --headless --no-sandbox --disable-gpu --disable-gpu-sandbox --dump-dom https://www.chromestatus.com/ - RUN CHROME_HEADLESS_DEPS="libglib2.0-0 libnss3 libdbus-1-3 libatk1.0-0 libatk-bridge2.0-0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libxkbcommon0 libasound2"; \ TOOLS="unzip curl"; \ SELENIUM="default-jre-headless"; \ - PYTHON="python3 python3-pip python3-venv"; \ + PYTHON="python3 python3-venv"; \ apt -y update \ && apt -y install ${TOOLS} ${SELENIUM} ${PYTHON} ${CHROME_HEADLESS_DEPS} \ && apt clean @@ -24,12 +22,22 @@ RUN curl -fLo chrome-headless.zip https://storage.googleapis.com/chrome-for-test && rm "chromedriver.zip" \ && rm LATEST_RELEASE_STABLE -RUN python3 -m venv venv \ - && curl -fLo selenium-server.jar https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.9.0/selenium-server-4.9.0.jar \ +# Copy everything according .Dockerignore +COPY . . + +RUN apt -y update \ + && apt -y install python3-pip \ + && python3 -m venv venv \ + && pip install -r requirements.txt \ + && apt -y purge python3-pip \ + && apt -y autopurge \ + && apt clean + +RUN curl -fLo selenium-server.jar https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.9.0/selenium-server-4.9.0.jar \ && java -jar selenium-server.jar standalone --version \ && chromedriver --version \ - && python3 --version \ - && pip --version + && python3 --version # This doesn't work -#&& chrome --no-sandbox --disable-gpu-sandbox +# ./chrome-headless-shell --headless --no-sandbox --disable-gpu --disable-gpu-sandbox --dump-dom https://www.chromestatus.com/ +# chrome --no-sandbox --disable-gpu-sandbox