Spaces:
s
Configuration error

s
File size: 1,253 Bytes
0ff5bc0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Use an official Python runtime as the parent image
FROM python:3.11-bullseye

RUN apt-get update && apt-get install -y \
    ffmpeg \
    imagemagick \
    ghostscript \
    fonts-roboto \
    cron \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# Update font cache
RUN fc-cache -f -v

RUN sed -i '/<policy domain="path" rights="none" pattern="@\*"/d' /etc/ImageMagick-6/policy.xml

# Clean up APT when done
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Set the working directory in the container to /app
WORKDIR /app

# Install any Python packages specified in requirements.txt
# Copy requirements file
COPY requirements.txt .

# Install dependencies
RUN pip install -r requirements.txt --no-cache-dir

# Copy the local package directory content into the container at /app
COPY . /app

EXPOSE 31415

# Define any environment variables
# ENV KEY Value

# Print environment variables (for debugging purposes, you can remove this line if not needed)
RUN ["printenv"]

# Add cron job
RUN echo "0 */1 * * * /bin/bash /app/automate.sh" > /etc/cron.d/automate
RUN chmod 0644 /etc/cron.d/automate
RUN crontab /etc/cron.d/automate
RUN touch /var/log/cron.log

# Run Python script when the container launches
CMD cron && tail -f /var/log/cron.log