スクレイピングから機械学習するまでのDockerfile
pytorchの公式イメージをベースとしてスクレイピング系とboosting系を乗っける。
jupyter-labも使える。
想定としてはwebのデータをNN系とboosting系で機械学習する人向け。
自然言語系の環境も整えたいけどやったことないからだれか・・・
chrome-driverのバージョンは自分が使っている(であろう)ブラウザから「ヘルプ→chromeについて」みたいなところからバージョンを確認して揃える。
※2022年7/4時点では以下で動作確認。
Dockerfile
FROM pytorch/pytorch:latest ENV TZ=Asia/Tokyo RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt-get -y update \ && apt-get -y upgrade \ && apt-get install -y unzip zip tzdata git wget gnupg RUN apt-get install -y libgl1-mesa-glx libglib2.0-0 libsm6 libxrender1 libxext6 # chrome RUN wget -q -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' | tee /etc/apt/sources.list.d/google-chrome.list && \ apt-get update && \ apt-get install -y google-chrome-stable # chrome driver(ドライバのバージョンは適切なものを入れる) ADD https://chromedriver.storage.googleapis.com/103.0.5060.24/chromedriver_linux64.zip /opt/chrome/ RUN cd /opt/chrome/ && \ unzip chromedriver_linux64.zip && \ rm -f chromedriver_linux64.zip # labは最新のを入れる RUN python -m pip install --upgrade pip RUN pip install jupyterlab RUN pip install ipywidgets # seleniumも最新の入れる RUN pip install selenium RUN pip install bs4 RUN pip install oauth2client # requirements.txtのインストール WORKDIR /app ADD requirements.txt /app RUN pip install -r requirements.txt
requirements.txt
※僕の趣味で何個か無駄なライブラリが入ってる(tweepyとか)
lxml==4.9.1 matplotlib==3.5.2 pandas==1.4.3 scikit-learn==1.1.1 seaborn==0.11.2 sympy==1.10.1 opencv-python==4.6.0.66 opencv-contrib-python==4.6.0.66 tweepy==4.10.0 schedule==1.1.0 tensorboardX==2.5.1 torchsummary==1.5.1 xgboost==1.6.1 lightgbm==3.3.2 catboost==1.0.6