diff --git a/Dockerfile b/Dockerfile index 6da75dd..7527e45 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,7 @@ RUN pip install --no-cache-dir -r requirements.txt COPY bot.py . COPY config.py . +COPY entrypoint.sh . # Create DB directory with proper permissions RUN mkdir -p /app/DB && chown -R botuser:botgroup /app @@ -20,4 +21,5 @@ ENV PYTHONUNBUFFERED=1 # Switch to non-root user USER botuser +ENTRYPOINT ["/app/entrypoint.sh"] CMD ["python", "bot.py"] diff --git a/docker-compose.yml b/docker-compose.yml index a7f0a50..809f8cb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,3 +12,4 @@ services: restart: unless-stopped volumes: - ./DB:/app/DB + entrypoint: ["/app/entrypoint.sh", "python", "bot.py"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..bc986c7 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e + +# Fix permissions for DB folder +chown -R botuser:botgroup /app/DB + +exec "$@" \ No newline at end of file