From 2fcea33380ebb8df05bea09cc5b0a4b90be55d2e Mon Sep 17 00:00:00 2001 From: Adedapo Aderemi Date: Mon, 19 Feb 2024 22:24:52 +0000 Subject: [PATCH] add python to dockerfile --- Dockerfile | 30 +++--- scripts/requirements.txt | 196 --------------------------------------- 2 files changed, 18 insertions(+), 208 deletions(-) delete mode 100644 scripts/requirements.txt diff --git a/Dockerfile b/Dockerfile index 2e07914..55c4ab7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,21 @@ # Use the official Node.js image as a base FROM node:16-slim -RUN apt-get update && apt-get -y upgrade && apt-get install -y ca-certificates curl apt-transport-https lsb-release gnupg +# Install essential packages +RUN apt-get update \ + && apt-get install -y \ + python3 \ + python3-pip \ + && rm -rf /var/lib/apt/lists/* + +# Set up a working directory +WORKDIR /usr/src/app +# Continue with existing setup +RUN apt-get update && apt-get -y upgrade && apt-get install -y ca-certificates curl apt-transport-https lsb-release gnupg ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 ARG DEBIAN_FRONTEND=noninteractive -# 0. Install essential packages RUN apt-get update \ && apt-get install -y \ build-essential \ @@ -23,8 +32,6 @@ RUN apt-get update \ && curl -L https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz | tar xz -C /usr/local/bin \ && rm -rf /var/lib/apt/lists/* -# 2) Install latest stable Chrome -# https://gerg.dev/2021/06/making-chromedriver-and-chrome-versions-match-in-a-docker-image/ RUN echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | \ tee -a /etc/apt/sources.list.d/google.list @@ -34,10 +41,6 @@ RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | \ RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb RUN apt-get install ./google-chrome-stable_current_amd64.deb -# 3) Install the Chromedriver version that corresponds to the installed major Chrome version -# https://blogs.sap.com/2020/12/01/ui5-testing-how-to-handle-chromedriver-update-in-docker-image/ -# For some reason, there is a breaking change with Chrome driver and the latest google chrome browser. Hence, the reason for default Chrome driver to the last know working version -# TODO=> Find fix for breaking change =:) RUN google-chrome --version | grep -oE "[0-9]{1,10}.[0-9]{1,10}.[0-9]{1,10}" > /tmp/chromebrowser-main-version.txt RUN wget --no-verbose -O /tmp/latest_chromedriver_version.txt https://chromedriver.storage.googleapis.com/LATEST_RELEASE_114.0.5735 RUN wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/114.0.5735.90/chromedriver_linux64.zip \ @@ -47,17 +50,20 @@ RUN wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.stor && chmod 755 /opt/selenium/chromedriver-$(cat /tmp/latest_chromedriver_version.txt) \ && ln -fs /opt/selenium/chromedriver-$(cat /tmp/latest_chromedriver_version.txt) /usr/bin/chromedriver - -WORKDIR /app - +# Install Node.js dependencies RUN npm config set unsafe-perm true RUN npm i selenium-webdriver COPY package*.json ./ - RUN npm i +# Copy the application code COPY . . +# Install Python dependencies +RUN pip3 freeze > requirements.txt +# RUN pip3 install --no-cache-dir -r requirements.txt + +# Expose port EXPOSE 3000 # Start the application diff --git a/scripts/requirements.txt b/scripts/requirements.txt deleted file mode 100644 index 7f0923e..0000000 --- a/scripts/requirements.txt +++ /dev/null @@ -1,196 +0,0 @@ -alabaster==0.7.16 -ansible==8.7.0 -ansible-core==2.15.8 -applaunchservices==0.3.0 -appnope==0.1.4 -argcomplete==1.10.3 -arrow==1.3.0 -astroid==3.0.3 -asttokens==2.4.1 -atomicwrites==1.4.1 -attrs==23.2.0 -autopep8==2.0.4 -Babel==2.14.0 -beautifulsoup4==4.8.2 -binaryornot==0.4.4 -black==24.1.1 -bleach==6.1.0 -bs4==0.0.2 -certifi==2024.2.2 -cffi @ file:///private/tmp/cffi-20231212-42180-nb05ya/cffi-1.16.0 -chardet==3.0.4 -charset-normalizer==3.3.2 -click==8.1.7 -cloudpickle==3.0.0 -comm==0.2.1 -compressed-rtf==1.0.6 -cookiecutter==2.5.0 -cryptography @ file:///private/tmp/python-cryptography-20231128-6750-3kl159/cryptography-41.0.7 -debugpy==1.8.1 -decorator==5.1.1 -defusedxml==0.7.1 -deprecation==2.1.0 -diff-match-patch==20230430 -dill==0.3.8 -doc2python==0.0.7 -docstring-to-markdown==0.13 -docutils==0.20.1 -docx2python==2.8.0 -docx2txt==0.8 -ebcdic==1.1.1 -exceptiongroup==1.2.0 -executing==2.0.1 -extract-msg==0.28.7 -fastjsonschema==2.19.1 -flake8==7.0.0 -h11==0.14.0 -idna==3.6 -imagesize==1.4.1 -IMAPClient==2.1.0 -importlib-metadata==7.0.1 -importlib-resources==5.0.7 -inflection==0.5.1 -intervaltree==3.1.0 -ipykernel==6.29.2 -ipython==8.18.1 -isort==5.13.2 -jaraco.classes==3.3.1 -jedi==0.19.1 -jellyfish==1.0.3 -Jinja2 @ file:///private/tmp/python-jinja-20231112-5574-1ao0niv/Jinja2-3.1.2 -jsonschema==4.21.1 -jsonschema-specifications==2023.12.1 -jupyter_client==8.6.0 -jupyter_core==5.7.1 -jupyterlab_pygments==0.3.0 -keyring==24.3.0 -lxml==4.9.2 -markdown-it-py==3.0.0 -MarkupSafe @ file:///private/tmp/python-markupsafe-20231211-22630-e8w2tp/MarkupSafe-2.1.3 -matplotlib-inline==0.1.6 -mccabe==0.7.0 -mdurl==0.1.2 -mistune==3.0.2 -more-itertools==10.2.0 -mypy-extensions==1.0.0 -nbclient==0.9.0 -nbconvert==7.16.0 -nbformat==5.9.2 -nest-asyncio==1.6.0 -numpy==1.26.4 -numpydoc==1.6.0 -olefile==0.46 -outcome==1.3.0.post0 -packaging @ file:///private/tmp/python-packaging-20231211-11583-vmtfsi/packaging-23.2 -pandas==2.2.0 -pandocfilters==1.5.1 -parso==0.8.3 -pathspec==0.12.1 -pdfminer.six==20191110 -pefile==2023.2.7 -pexpect==4.9.0 -pickleshare==0.7.5 -pikepdf==7.2.0 -Pillow==9.5.0 -platformdirs==4.2.0 -pluggy==1.4.0 -prompt-toolkit==3.0.43 -protobuf==4.25.2 -psutil==5.9.8 -psycopg2-binary==2.9.9 -ptyprocess==0.7.0 -pure-eval==0.2.2 -pycodestyle==2.11.1 -pycparser @ file:///private/tmp/pycparser-20231211-26290-qd4lvz/pycparser-2.21 -pycryptodome==3.17 -pydocstyle==6.3.0 -pyflakes==3.2.0 -Pygments==2.17.2 -pylint==3.0.3 -pylint-venv==3.0.3 -pyls-spyder==0.4.0 -pyobjc-core==10.1 -pyobjc-framework-Cocoa==10.1 -pyobjc-framework-CoreServices==10.1 -pyobjc-framework-FSEvents==10.1 -pyparsing @ file:///private/tmp/python-pyparsing-20231212-64945-nd3w2a/pyparsing-3.1.1 -PyQt5==5.15.10 -PyQt5-Qt5==5.15.12 -PyQt5-sip==12.13.0 -PyQtWebEngine==5.15.6 -PyQtWebEngine-Qt5==5.15.12 -PySocks==1.7.1 -python-dateutil @ file:///private/tmp/python-dateutil-20231119-5331-hv8omd/python-dateutil-2.8.2 -python-dotenv==1.0.1 -python-lsp-black==2.0.0 -python-lsp-jsonrpc==1.1.2 -python-lsp-server==1.10.0 -python-pptx==0.6.21 -python-slugify==8.0.4 -pytoolconfig==1.3.1 -pytz==2024.1 -pytz-deprecation-shim==0.1.0.post0 -pywatchman==1.4.1 -PyYAML @ file:///private/tmp/pyyaml-20231019-6134-1qsnlp0/PyYAML-6.0.1 -pyzmq==25.1.2 -QDarkStyle==3.2.3 -qstylizer==0.2.2 -QtAwesome==1.3.0 -qtconsole==5.5.1 -QtPy==2.4.1 -referencing==0.33.0 -requests==2.31.0 -resolvelib==1.0.1 -rich==13.7.0 -rope==1.12.0 -rpds-py==0.17.1 -Rtree==1.2.0 -selenium==4.17.2 -six==1.12.0 -sniffio==1.3.0 -snowballstemmer==2.2.0 -sortedcontainers==2.4.0 -soupsieve==2.4.1 -SpeechRecognition==3.8.1 -Sphinx==7.2.6 -sphinxcontrib-applehelp==1.0.8 -sphinxcontrib-devhelp==1.0.6 -sphinxcontrib-htmlhelp==2.0.5 -sphinxcontrib-jsmath==1.0.1 -sphinxcontrib-qthelp==1.0.7 -sphinxcontrib-serializinghtml==1.1.10 -spyder==5.5.1 -spyder-kernels==2.5.0 -stack-data==0.6.3 -tabulate==0.9.0 -text-unidecode==1.3 -textdistance==4.6.1 -textract==1.6.5 -three-merge==0.1.1 -tinycss2==1.2.1 -tomli==2.0.1 -tomlkit==0.12.3 -tornado==6.4 -traitlets==5.14.1 -trio==0.24.0 -trio-websocket==0.11.1 -types-python-dateutil==2.8.19.20240106 -typing_extensions==4.9.0 -tzdata==2023.3 -tzlocal==4.3 -ujson==5.9.0 -Unidecode==1.3.8 -urllib3==1.26.15 -urlopen==1.0.0 -volatility3==2.5.2 -watchdog==4.0.0 -wcwidth==0.2.13 -webdriver-manager==4.0.1 -webencodings==0.5.1 -whatthepatch==1.0.5 -wsproto==1.2.0 -wurlitzer==3.0.3 -xlrd==1.2.0 -XlsxWriter==3.1.0 -yapf==0.40.2 -zipp==3.17.0