creaded correct docker image creation file
This commit is contained in:
10
Dockerfile
10
Dockerfile
@@ -5,11 +5,13 @@ FROM python:3.13-slim
|
||||
WORKDIR /app
|
||||
|
||||
# Install system dependencies
|
||||
# Note: LibreOffice is excluded from the base image to reduce size (~500MB)
|
||||
# It can be installed on-demand via the Admin Panel → System Dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
poppler-utils \
|
||||
libreoffice \
|
||||
ffmpeg \
|
||||
libmagic1 \
|
||||
sudo \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy requirements first for better caching
|
||||
@@ -36,9 +38,11 @@ ENV FLASK_ENV=production
|
||||
# Expose port
|
||||
EXPOSE 5000
|
||||
|
||||
# Create a non-root user
|
||||
# Create a non-root user and grant sudo access for dependency installation
|
||||
RUN useradd -m -u 1000 appuser && \
|
||||
chown -R appuser:appuser /app /docker-entrypoint.sh
|
||||
chown -R appuser:appuser /app /docker-entrypoint.sh && \
|
||||
echo "appuser ALL=(ALL) NOPASSWD: /app/install_libreoffice.sh" >> /etc/sudoers && \
|
||||
chmod +x /app/install_libreoffice.sh
|
||||
|
||||
USER appuser
|
||||
|
||||
|
||||
Reference in New Issue
Block a user