diff --git a/api/api.py b/api/api.py index 0cb7d91..5f15a74 100644 --- a/api/api.py +++ b/api/api.py @@ -10,7 +10,7 @@ db_file = os.path.join('scrapers', 'jobs_db.json') # Path to db JSON file for development #db_file = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'scrapers', 'jobs_db.json') -@app.route('/api/jobs', methods=['GET']) +@app.route('/jobs', methods=['GET']) def get_jobs(): if os.path.exists(db_file): with open(db_file, 'r') as file: diff --git a/scrapers/Dockerfile b/scrapers/Dockerfile index 580a0a0..e0c7970 100644 --- a/scrapers/Dockerfile +++ b/scrapers/Dockerfile @@ -4,18 +4,22 @@ FROM python:3.9-slim # Set the working directory in the container WORKDIR /app +# Install cron and any needed packages specified in requirements.txt +RUN apt-get update && apt-get install -y cron \ + && pip install --no-cache-dir -r requirements.txt + # Copy the current directory contents into the container at /app COPY . /app -# Install any needed packages specified in requirements.txt -RUN pip install --no-cache-dir -r requirements.txt - # Copy the crontab file to the cron.d directory COPY crontab /etc/cron.d/scraper-cron # Give execution rights on the cron job RUN chmod 0644 /etc/cron.d/scraper-cron +# Apply cron job +RUN crontab /etc/cron.d/scraper-cron + # Create the log file to be able to run tail RUN touch /var/log/cron.log