Upload files to "/"

This commit is contained in:
lasse 2025-04-01 08:45:17 +00:00
parent fb415260ba
commit 68f7bd31ad
4 changed files with 113 additions and 0 deletions

30
pyDockerfile Normal file
View File

@ -0,0 +1,30 @@
#use this image for large python programms
#it is larger than the alpine image,
#but has many python packages preinstalled and it is easy to install new ones
FROM python:3.10-bullseye
#RUN rm -r /pyapp
#will be the working directory later
RUN mkdir /pyapp
#sets the new working directory
WORKDIR /pyapp
#install required packages
ADD requirements.txt .
RUN pip install -r requirements.txt
#unbuffered output to stdout
#used it that Python gives out all prints, if not, it will buffer them until many prints done
ENV PYTHONUNBUFFERED 1
#copies the whole directory into the working directory
COPY . /pyapp/

17
requirements.txt Normal file
View File

@ -0,0 +1,17 @@
psycopg2-binary==2.9.6
numpy==1.23.5
sqlalchemy==2.0.15
SQLAlchemy-Utils==0.41.1
selenium==4.9.0
pandas==2.0.3

31
seleniumDockerfile Normal file
View File

@ -0,0 +1,31 @@
#image that has selenium and chrome installed, official by selenium
FROM selenium/standalone-chrome:4.10.0-20230607
#will be the working directory later
#RUN mkdir /pyapp
#sets the new working directory
WORKDIR /pyapp
#user permissions heikel !!!!!
USER root
RUN apt-get update && apt-get install -y \
python3-pip
#install required packages
ADD requirements.txt .
RUN pip3 install -r requirements.txt --user
RUN export PATH=/home/seluser/.local/bin:$PATH
USER 1001
#unbuffered output to stdout
#used it that Python gives out all prints, if not, it will buffer them until many prints done
ENV PYTHONUNBUFFERED 1
#copies the whole directory into the working directory
COPY . /pyapp/

35
statusAndStopScript.sh Normal file
View File

@ -0,0 +1,35 @@
#while running
#wait 10 seconds
#docker stop of containers that only run for containers that already stopped
#e.g. dobby and selenium
#first have to start all containers
sleep 20
#checks status of dobby container and saves into json file
docker inspect py_extract_dobby_test_vimes > outputInspect.json
#check if that container still running
outputRunning=$(jq '.[0].State.Running' outputInspect.json)
#sleep as long as dobby
while $outputRunning
do
echo $(date)
sleep 10
#checks status of dobby container and saves into json file
docker inspect py_extract_dobby_test_vimes > outputInspect.json
#check if that container still running
outputRunning=$(jq '.[0].State.Running' outputInspect.json)
done
#since dobby is done reading out data, we can stop the selenium container
docker stop "sel_browser_test_vimes"