FROM ubuntu:18.04 as chromium_image
USER root
# Install Chromium and ChromeDriver
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository universe && \
apt-get install -y chromium-browser && \
apt-get install -y chromium-chromedriver
# Install Selenium
RUN apt-get install -y python3-venv && \
python3 -m venv create /tmp/python_env && \
/bin/bash -c "source /tmp/python_env/bin/activate; pip3 install selenium"
FROM chromium_image as cert_image
COPY ./ca_certs/cert.pem /tmp/mitm.crt
RUN apt-get update && apt-get install -y libnss3-tools &&\
mkdir -p $HOME/.pki/nssdb &&\
certutil -d $HOME/.pki/nssdb -N --empty-password
RUN certutil -d sql:$HOME/.pki/nssdb -A -n 'mitm cert authority' -i /tmp/mitm.crt -t "C,,"
FROM cert_image
RUN mkdir -p /tmp/test_files
COPY test_against_chrome.py /tmp/test_files
CMD /bin/bash -c "source /tmp/python_env/bin/activate; python3 /tmp/test_files/test_against_chrome.py"