Fixed container: to allow access to folder structure

This commit is contained in:
2025-10-05 00:12:22 +02:00
parent 9c227cc320
commit 6c282da6fa

View File

@@ -20,28 +20,32 @@ WORKDIR /app
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
gcc \ gcc \
sqlite3 \ sqlite3 \
curl \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Create non-root user for security # Create non-root user for security
RUN addgroup --system --gid 1001 chatbot && \ RUN addgroup --system --gid 1001 chatbot && \
adduser --system --uid 1001 --gid 1001 --no-create-home --disabled-password chatbot adduser --system --uid 1001 --gid 1001 --no-create-home --disabled-password chatbot
# Create necessary directories with proper permissions
RUN mkdir -p /app/data /app/logs /app/static && \
chown -R chatbot:chatbot /app
# Copy requirements first for better Docker layer caching # Copy requirements first for better Docker layer caching
COPY requirements.txt . COPY requirements.txt .
RUN chown chatbot:chatbot requirements.txt
# Install Python dependencies # Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# Copy application code # Copy application code
COPY . . COPY . .
RUN chown -R chatbot:chatbot .
# Create necessary directories and set permissions
RUN mkdir -p /app/databases /app/logs /app/static && \
chown -R chatbot:chatbot /app
# Copy entrypoint script # Copy entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
chown chatbot:chatbot /usr/local/bin/docker-entrypoint.sh
# Switch to non-root user # Switch to non-root user
USER chatbot USER chatbot