scraper dockerfile and cronjob to run when container starts
Some checks failed
Build and Push Docker Images / build (push) Failing after 26s
Some checks failed
Build and Push Docker Images / build (push) Failing after 26s
This commit is contained in:
parent
5d01c5a315
commit
f0aff65ba1
@ -4,14 +4,14 @@ FROM python:3.9-slim
|
|||||||
# Set the working directory inside the container
|
# Set the working directory inside the container
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy the current directory contents into the container at /app
|
# Copy the script and requirements.txt into the container at /app
|
||||||
COPY . /app
|
COPY jobindex.py /app/
|
||||||
|
COPY requirements.txt /app/
|
||||||
|
|
||||||
# Install cron and the required Python packages
|
# Install the required Python packages
|
||||||
RUN apt-get update && apt-get install -y cron && \
|
RUN pip install -r requirements.txt
|
||||||
pip install requests beautifulsoup4
|
|
||||||
|
|
||||||
# Copy and add a cron job to run the script every hour
|
# Copy the cron job file into the cron directory
|
||||||
COPY cronjob /etc/cron.d/jobindex-cron
|
COPY cronjob /etc/cron.d/jobindex-cron
|
||||||
|
|
||||||
# Give execution rights on the cron job
|
# Give execution rights on the cron job
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
# Run the jobindex.py script every hour
|
# Run the jobindex.py script every hour
|
||||||
0 * * * * root python /app/jobindex.py >> /var/log/cron.log 2>&1
|
0 * * * * python /app/jobindex.py >> /var/log/cron.log 2>&1
|
||||||
|
Loading…
Reference in New Issue
Block a user