Dockerized web scraper fetching Nigerian artists' data from Wikipedia using Python for easy deploy.
181
This project is a web scraper that fetches data about Nigerian artists and their personalities from a Wikipedia page and saves it to a text file. The project is containerized using Docker for easy deployment and portability.
The project consists of the following files:
artist_scrape.py: This is the main Python script that performs the web scraping.requirements.txt: This file lists the Python dependencies that need to be installed.Dockerfile: This file contains the instructions to build the Docker image for this project.Install Docker on your machine. You can access this link to download Docker: Docker Desktop Installation for Windows. Familiarize yourself with Docker commands and concepts such as images, containers, and Dockerfiles.
Based on the OS you are running, you may require additional base configuration for your machine, especially if it's Windows. Check if WSL (Windows Subsystem for Linux) is present on your machine and follow the steps outlined in this link: Install WSL.
Ensure that all necessary files (artist_scrape.py, requirements.txt, Dockerfile) are saved in the correct format and stored in one directory.
Open a terminal or Windows PowerShell, navigate to the project directory, and build the Docker image using the following command:
docker build -t artist_scraper .
Note: artist_scraper is just the name of the image and can be renamed as needed.
Run a Docker container from the image you just built using the following command:
docker run --rm -v C:\Users\DELL\Desktop\pyprojects\BDA\task2:/app artist_scraper
#or
docker run -p atirst_scraper
This command mounts the local directory to the /app directory in the Docker container, ensuring the output file is saved to your local machine.
To verify that the data was scraped and saved correctly, check the Nigerian_Artists.txt file in the specified directory on your local machine. The file should contain the scraped data about Nigerian artists and their personalities.
Dockerfile is saved without any extension (e.g., .txt). This prevents errors during the build process.artist_scrape.py) runs correctly on its own before introducing it into Docker. Any modifications to the Dockerfile, Python script, or requirements.txt will require rebuilding the Docker image.To push the Docker image to a container registry (e.g., Docker Hub), follow these steps:
Log In to Docker Hub:
docker login
Tag the Docker Image:
docker tag artist_scraper your_username/artist_scraper:latest
Push the Docker Image:
docker push your_username/artist_scraper:latest
Note: Replace your_username with your Docker Hub username.
This README provides a comprehensive guide to setting up, running, and troubleshooting the Nigerian Artists Web Scraper project using Docker.
Content type
Image
Digest
sha256:096597737…
Size
45.6 MB
Last updated
over 2 years ago
docker pull icklint/artist_scraper