From 205c8eb9b7d54f36374f8fa632f867d45cd39aac Mon Sep 17 00:00:00 2001 From: Eaven Kimura Date: Mon, 29 Sep 2025 04:40:19 +0000 Subject: [PATCH 1/3] Fix: Dependency update for Docker image --- dockerfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dockerfile b/dockerfile index ded24ea..e14ae1c 100644 --- a/dockerfile +++ b/dockerfile @@ -18,12 +18,15 @@ COPY requirements.txt . RUN --mount=type=cache,target=/root/.cache/pip \ pip install --no-cache-dir -r requirements.txt -# Final stage - using smaller base image +# Final stage - using Alpine with build dependencies FROM python:3.11-alpine3.18 -# Install minimal runtime dependencies +# Install runtime and build dependencies RUN apk add --no-cache \ tini \ + build-base \ + python3-dev \ + openblas-dev \ && rm -rf /var/cache/apk/* # Set working directory @@ -33,13 +36,15 @@ WORKDIR /app COPY --from=builder /opt/venv /opt/venv ENV PATH="/opt/venv/bin:$PATH" +# Reinstall numpy to ensure Alpine compatibility +RUN pip install --no-cache-dir --force-reinstall numpy + # Create a non-root user RUN addgroup -S bot && adduser -S bot -G bot # Copy necessary files COPY --chown=bot:bot *.py ./ COPY --chown=bot:bot entrypoint.sh ./ -# Add other necessary directories/files as needed # Create directories for persistent storage RUN mkdir -p logs embed && \ -- 2.49.1 From 135d596119f4131bd8b9c630e7f6c94fdf224646 Mon Sep 17 00:00:00 2001 From: Eaven Kimura Date: Mon, 29 Sep 2025 04:52:17 +0000 Subject: [PATCH 2/3] Fix: Dependency update for Docker image --- dockerfile | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/dockerfile b/dockerfile index e14ae1c..bf4b633 100644 --- a/dockerfile +++ b/dockerfile @@ -18,16 +18,13 @@ COPY requirements.txt . RUN --mount=type=cache,target=/root/.cache/pip \ pip install --no-cache-dir -r requirements.txt -# Final stage - using Alpine with build dependencies -FROM python:3.11-alpine3.18 +# Final stage - using slim instead of alpine +FROM python:3.11-slim -# Install runtime and build dependencies -RUN apk add --no-cache \ +# Install minimal runtime dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ tini \ - build-base \ - python3-dev \ - openblas-dev \ - && rm -rf /var/cache/apk/* + && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app @@ -36,11 +33,8 @@ WORKDIR /app COPY --from=builder /opt/venv /opt/venv ENV PATH="/opt/venv/bin:$PATH" -# Reinstall numpy to ensure Alpine compatibility -RUN pip install --no-cache-dir --force-reinstall numpy - # Create a non-root user -RUN addgroup -S bot && adduser -S bot -G bot +RUN groupadd -r bot && useradd -r -g bot bot # Copy necessary files COPY --chown=bot:bot *.py ./ -- 2.49.1 From 55971496c842c6cfe4489cbc487d4d0cc82f9bfd Mon Sep 17 00:00:00 2001 From: Eaven Kimura Date: Mon, 29 Sep 2025 05:07:24 +0000 Subject: [PATCH 3/3] Fix: Matplotlib permission error --- dockerfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dockerfile b/dockerfile index bf4b633..e4c72a9 100644 --- a/dockerfile +++ b/dockerfile @@ -18,7 +18,7 @@ COPY requirements.txt . RUN --mount=type=cache,target=/root/.cache/pip \ pip install --no-cache-dir -r requirements.txt -# Final stage - using slim instead of alpine +# Final stage - using slim FROM python:3.11-slim # Install minimal runtime dependencies @@ -45,6 +45,11 @@ RUN mkdir -p logs embed && \ chown -R bot:bot /app logs embed && \ chmod -R 777 /app logs embed +# Create and set permissions for matplotlib config directory +RUN mkdir -p /tmp/matplotlib && \ + chown -R bot:bot /tmp/matplotlib && \ + chmod -R 777 /tmp/matplotlib + # Switch to non root user USER bot @@ -53,6 +58,8 @@ ENV PYTHONUNBUFFERED=1 ENV CONFIG_PATH=/app/config.ini ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONPYCACHEPREFIX=/tmp +ENV MPLCONFIGDIR=/tmp/matplotlib +ENV MPLBACKEND=Agg # Run the bot using tini and entrypoint script ENTRYPOINT ["tini", "--", "/bin/sh", "entrypoint.sh"] \ No newline at end of file -- 2.49.1