Files
pterodactyl-discord-bot/dockerfile
k.eaven a336d9f97e
Some checks failed
Docker Build and Push / build-and-push (push) Failing after 3m27s
Add Docker build workflow
2025-08-11 03:13:37 -07:00

36 lines
905 B
Plaintext

# Use official Python image
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install dependencies
RUN apt-get update && apt-get install -y \
gcc \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application
COPY . .
# Create a non-root user and switch to it
RUN useradd -m bot
USER bot
# Create directories for persistent storage and modify permissions
RUN chown -R bot:bot /app && chmod -R 777 /app
RUN mkdir -p /app/logs && chmod -R 777 /app/logs
RUN mkdir -p /app/embed && chmod -R 777 /app/embed
# Set environment variables for configuration
ENV PYTHONUNBUFFERED=1
ENV CONFIG_PATH=/app/config.ini
# Command to run the bot
CMD ["sh", "-c", "python generate_config.py && python pterodisbot.py"]