openwebui-anthropic / Dockerfile
cotcotquedec's picture
chore(docker): set default user to non-root in Dockerfile
0e6018e
raw
history blame contribute delete
989 Bytes
# Use Python 3.12 slim base image to keep the image size small
FROM python:3.12-slim
# Create a non-root user with UID 1000 for security best practices
RUN useradd -m -u 1000 user
# Set Python path to /app directory
ENV PYTHONPATH="/app"
# Set the working directory for all subsequent commands
WORKDIR /app
# Install system dependencies and clean up apt cache to reduce image size
RUN apt-get update && apt-get install -y \
curl wget git-core\
&& rm -rf /var/lib/apt/lists/*
# Copy requirements file with appropriate permissions and install dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code with appropriate ownership
COPY --chown=user . /app
# Document the port that the application will listen on
EXPOSE 9099
USER user
# Define the command to run the FastAPI application using uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "9099"]