build init.py on docker

This commit is contained in:
Mateusz 2022-03-31 20:15:29 +02:00 committed by Wirusik
parent d1d07e5c47
commit 34dfb19ddc
3 changed files with 54930 additions and 12 deletions

View File

@ -1,14 +1,27 @@
# Nasz obraz będzie dzidziczył z obrazu Ubuntu w wersji latest # Latest Ubuntu as starter
FROM ubuntu:latest FROM ubuntu:latest
# Instalujemy niezbędne zależności. Zwróć uwagę na flagę "-y" (assume yes) # Install required dependencies
RUN apt update && apt install -y figlet RUN apt update
RUN export PATH=$PATH:/usr/local/bin/python”
RUN apt install python3-pip -y
RUN apt install unzip -y
RUN pip install kaggle
RUN pip install pandas
RUN pip install scikit-learn
RUN pip install matplotlib
RUN mkdir ~/.kaggle/
RUN echo '{"username":"wirus006","key":"c3323e37d3f91a0914d0172ef3c7c30c"}' > ~/.kaggle/kaggle.json
# Stwórzmy w kontenerze (jeśli nie istnieje) katalog /app i przejdźmy do niego (wszystkie kolejne polecenia RUN, CMD, ENTRYPOINT, COPY i ADD będą w nim wykonywane) # Create app directory in image
WORKDIR /app WORKDIR /app
# Skopiujmy nasz skrypt do katalogu /app w kontenerze # Copy init dataset script to /app directory in image
COPY ./figlet-loop.sh ./app COPY ./init.py ./
# Domyślne polecenie, które zostanie uruchomione w kontenerze po jego starcie # Download kaggle dataset
CMD ./figlet-loop.sh RUN kaggle datasets download -d hakeem/atp-and-wta-tennis-data
RUN unzip -o atp-and-wta-tennis-data.zip
# Script executed after docker run
CMD python3 ./init.py

View File

@ -10,10 +10,6 @@ import matplotlib
file_exists = exists('./df_atp.csv') file_exists = exists('./df_atp.csv')
if not file_exists: if not file_exists:
subprocess.run(["pip", "install", "--user", "kaggle"])
subprocess.run(["pip", "install", "--user", "pandas"])
subprocess.run(["pip", "install", "--user", "scikit-learn"])
# subprocess.run(["pip", "install", "--user", "matplotlib"])
subprocess.run(["kaggle", "datasets", "download", "-d", "hakeem/atp-and-wta-tennis-data"]) subprocess.run(["kaggle", "datasets", "download", "-d", "hakeem/atp-and-wta-tennis-data"])
subprocess.run(["unzip", "-o", "atp-and-wta-tennis-data.zip"]) subprocess.run(["unzip", "-o", "atp-and-wta-tennis-data.zip"])

54909
result.csv Normal file

File diff suppressed because it is too large Load Diff