prod
This commit is contained in:
parent
d596ed7e19
commit
aa6626d80d
21 changed files with 1051 additions and 333 deletions
42
Dockerfile
42
Dockerfile
|
|
@ -2,45 +2,27 @@ FROM mcr.microsoft.com/playwright/python:v1.57.0-jammy
|
|||
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies
|
||||
# Install dependencies first (leverages Docker cache)
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy the handlers directory into the Docker image
|
||||
# Copy all Python source code and directories
|
||||
COPY handlers/ ./handlers/
|
||||
|
||||
# Copy application handler
|
||||
COPY application_handler.py .
|
||||
|
||||
# Copy Telegram bot
|
||||
COPY telegram_bot.py .
|
||||
|
||||
# Copy the tests directory
|
||||
COPY tests/ ./tests/
|
||||
COPY *.py ./
|
||||
|
||||
# Copy state manager
|
||||
COPY state_manager.py .
|
||||
# Setup data directory with proper permissions
|
||||
RUN mkdir -p /app/data && chmod 777 /app/data && \
|
||||
touch /app/data/state.json && chmod 666 /app/data/state.json
|
||||
|
||||
|
||||
# Copy autoclean_debug utility
|
||||
COPY autoclean_debug.py .
|
||||
|
||||
# Move the main.py COPY statement to the end to ensure it is updated last
|
||||
COPY main.py .
|
||||
|
||||
# Ensure the data directory exists
|
||||
RUN mkdir -p /app/data && chmod 777 /app/data
|
||||
|
||||
# Ensure the state.json file exists
|
||||
RUN touch /app/data/state.json && chmod 666 /app/data/state.json
|
||||
|
||||
# Copy fonts from the local data/fonts directory into the container
|
||||
# Install custom fonts for plot rendering
|
||||
COPY data/fonts/*.ttf /usr/share/fonts/truetype/custom/
|
||||
|
||||
# Refresh the font cache to include the new fonts
|
||||
RUN fc-cache -fv
|
||||
|
||||
# Log available fonts for debugging
|
||||
RUN fc-list
|
||||
# Health check: verify Python process is running and monitor.log is being updated
|
||||
HEALTHCHECK --interval=5m --timeout=30s --start-period=30s --retries=3 \
|
||||
CMD pgrep -f "python.*main.py" > /dev/null && \
|
||||
test -f /app/data/monitor.log && \
|
||||
test $(find /app/data/monitor.log -mmin -10 | wc -l) -gt 0 || exit 1
|
||||
|
||||
CMD ["python", "-u", "main.py"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue