Refactor project structure and enhance Docker support
- Removed unnecessary `__init__.py` and `Dockerfile` to streamline project organization. - Updated `.dockerignore` and `.gitignore` to improve exclusion patterns for build artifacts and environment files. - Enhanced `Makefile` with new commands for managing Docker containers and added help documentation. - Introduced `pyproject.toml` for better project metadata management and dependency tracking. - Updated `requirements.txt` to reflect changes in dependencies for metrics and monitoring. - Refactored various handler files to improve code organization and maintainability.
This commit is contained in:
37
Dockerfile
37
Dockerfile
@@ -1,37 +0,0 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# Use a lightweight Python image
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Prevent Python from writing .pyc files and enable unbuffered logs
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
# Install system dependencies (if required by Python packages)
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends build-essential \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Create non-root user
|
||||
RUN useradd -m appuser \
|
||||
&& chown -R appuser:appuser /app
|
||||
|
||||
# Install Python dependencies first for better layer caching
|
||||
COPY requirements.txt ./
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy project files
|
||||
COPY . .
|
||||
|
||||
# Ensure runtime directories exist and are writable
|
||||
RUN mkdir -p logs database \
|
||||
&& chown -R appuser:appuser /app
|
||||
|
||||
# Switch to non-root user
|
||||
USER appuser
|
||||
|
||||
# Run the bot
|
||||
CMD ["python", "run_helper.py"]
|
||||
Reference in New Issue
Block a user