All checks were successful
Docker Build and Push / build-and-push (push) Successful in 1m9s
46 lines
1.1 KiB
Plaintext
46 lines
1.1 KiB
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/*
|
|
|
|
# Install tini for better signal handling in container
|
|
RUN apt-get update && apt-get install -y tini
|
|
|
|
# Copy requirements first to leverage Docker cache
|
|
COPY requirements.txt .
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Create a non-root user
|
|
RUN groupadd -r bot && useradd -r -g bot bot
|
|
|
|
# Copy the rest of the application
|
|
COPY --chown=bot:bot . .
|
|
|
|
# Create directories for persistent storage and modify permissions
|
|
RUN chown -R bot:bot /app && \
|
|
chmod -R 777 /app
|
|
RUN mkdir -p logs && \
|
|
chown -R bot:bot logs && \
|
|
chmod -R 777 logs && \
|
|
mkdir -p embed && \
|
|
chown -R bot:bot embed && \
|
|
chmod -R 777 embed
|
|
|
|
# Switch to non root user
|
|
USER bot
|
|
|
|
# Set environment variables for configuration
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV CONFIG_PATH=/app/config.ini
|
|
|
|
# Run the bot using tini and entrypoint script
|
|
ENTRYPOINT ["tini", "--", "/bin/sh", "entrypoint.sh"] |