diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b4971d2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +# Use the official Selenium standalone Chrome image as base +FROM selenium/standalone-chrome:112.0.5615.165-chromedriver-112.0.5615.49 + +ENV DEBIAN_FRONTEND=noninteractive + +# Update package lists +RUN sudo apt-get update + +# Install Python 3.6 and pip +RUN sudo apt-get install -y python3 + +RUN sudo apt-get install -y python3-pip + +# Install Selenium and any other Python dependencies you may need +RUN sudo pip install selenium==3.141.0 +RUN sudo pip install --upgrade urllib3==1.26.16 +RUN sudo pip install Flask + +# Set the working directory +WORKDIR /usr/src/app + +# Copy your Python scripts into the container +COPY . . + +EXPOSE 8080 + +# Example command to run your Python script +CMD ["python3", "run.py"] diff --git a/README.md b/README.md index 02e5b69..033d408 100644 --- a/README.md +++ b/README.md @@ -66,10 +66,24 @@ This micro web server does not directly download the Instagram Reels video. It s git clone https://github.com/gabrielkheisa/instagram-downloader.git ``` +### With Dockerfile + +1. Build the Dockerfile + + ``` + sudo docker build -t instagram-downloader . + ``` + +2. Run the container + + ``` + sudo docker run -d -p 8080:8080 instagram-downloader + ``` + ## Usage -1. Start the Flask app: +1. Start the Flask app, skip this part if you use Docker: ``` python run.py diff --git a/run.py b/run.py index 6c7c38d..bf1df35 100644 --- a/run.py +++ b/run.py @@ -35,7 +35,7 @@ options.add_argument('--disable-gpu') options.add_argument('--window-size=1920,1080') options.add_argument('--no-sandbox') options.add_argument(f'user-agent={user_agent}') -browser = webdriver.Chrome(executable_path="/usr/bin/chromedriver", options=options) +browser = webdriver.Chrome(options=options) # Function to handle web scraping using Selenium def get_video_source(query_string):