From f20a5f2d39ed2f1728ecc2d2fcc427e582d7b75d Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Fri, 12 Apr 2024 15:16:18 -0700 Subject: [PATCH] feat: add docker containers with VNC access --- docker-compose.yml | 14 ++++++++++ dockerfiles/app/test/Dockerfile-vnc | 40 +++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 dockerfiles/app/test/Dockerfile-vnc diff --git a/docker-compose.yml b/docker-compose.yml index 57b541d1..17d03c09 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,3 +30,17 @@ services: volumes: - ./tests/cypress:/opt/test/cypress - ./entrypoint.sh:/opt/test/entrypoint.sh + # For local testing with access via VNC + materials-designer-test-vnc: + image: materials-designer-test:${IMAGE_TAG} + build: + args: + BASE_TAG: ${IMAGE_TAG} + context: . + dockerfile: ./dockerfiles/app/test/Dockerfile-vnc + # - materials-designer + ports: + - 5920:5920 + volumes: + - ./tests/cypress:/opt/test/cypress + - ./entrypoint.sh:/opt/test/entrypoint.sh diff --git a/dockerfiles/app/test/Dockerfile-vnc b/dockerfiles/app/test/Dockerfile-vnc new file mode 100644 index 00000000..b96cb4cb --- /dev/null +++ b/dockerfiles/app/test/Dockerfile-vnc @@ -0,0 +1,40 @@ +# From https://hub.docker.com/r/cypress/browsers/tags +FROM cypress/included:13.6.0 + +WORKDIR /opt/test + +COPY ./tests/package.json package.json +COPY ./tests/package-lock.json package-lock.json +COPY ./tests/cypress.config.ts cypress.config.ts +COPY ./tests/cypress cypress + +RUN npm install + + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + curl \ + libgtk2.0-0 \ + libgtk-3-0 \ + libgbm-dev \ + libnotify-dev \ + libgconf-2-4 \ + libnss3 \ + libxss1 \ + libasound2 \ + libxtst6 \ + xauth \ + xvfb \ + x11vnc \ + fluxbox + +# Install Chrome +RUN curl https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /tmp/google-chrome.deb +RUN apt-get install -y /tmp/google-chrome.deb + +RUN Xvfb :20 -screen 0 1920x1080x16 && \ + sleep 1 && \ + x11vnc -display :20 -N -forever -bg -o "/tmp/x11vnc.log" && \ + sleep 1 && \ + DISPLAY=:20 fluxbox -log /tmp/fluxbox.log & + +ENTRYPOINT ["tail", "-f", "/dev/null" ]