Java + Maven + Selenium + Chrome + ChromeDriver
4.5K
For easy startup just use this docker-compose.yml:
version: "3.8"
services:
java-selenium:
image: "mgzenitech/java-selenium:jdk14-chrome87.0.4280"
volumes:
- "./YOUR_TESTS_DIRECTORY:/app/tests"
And then run:
docker-compose up
Add --no-sandbox --headless switches when running your ChromeDriver tests, otherwise Chrome will crash.
FROM maven:3.6.3-openjdk-14-slim
RUN apt -y update \
&& apt -y install gnupg2=2.2.12-1+deb10u1 wget=1.20.1-1.1 unzip=6.0-23+deb10u1 \
&& rm -rf /var/lib/apt/lists/*
RUN curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add \
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
RUN apt -y update \
&& apt -y install google-chrome-stable=87.0.4280.66-1 \
&& rm -rf /var/lib/apt/lists/*
RUN wget -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/87.0.4280.20/chromedriver_linux64.zip \
&& unzip /tmp/chromedriver_linux64.zip -d /tmp \
&& mv /tmp/chromedriver /usr/bin/chromedriver \
&& chown root:root /usr/bin/chromedriver \
&& chmod +x /usr/bin/chromedriver \
&& rm -f /tmp/chromedriver_linux64.zip
# Please mount your tests repository to this volume mount point:
VOLUME "/app/tests"
WORKDIR "/app/tests"
CMD [ "mvn", "clean", "verify" ]
Content type
Image
Digest
Size
445.2 MB
Last updated
almost 6 years ago
docker pull mgzenitech/java-selenium