simple-chatbot-openai/Dockerfile
Hezi Aharon 2bef71abb2
All checks were successful
society-ai-hub-container-cache Actions Demo / build (push) Successful in 1m21s
Update Dockerfile
2024-11-18 05:36:37 +00:00

33 lines
803 B
Docker

# Use a slim base image to reduce potential vulnerabilities
FROM python:3.10-bookworm
# Create a non-root user and group with home directory set to /usr/src/app
RUN useradd --no-log-init -r -m -d /usr/src/app appuser
# Set the working directory
WORKDIR /usr/src/app
# Copy the requirements file and install the dependencies as root
COPY requirements.txt .
RUN pip install --no-cache-dir uv==0.4.28 && \
pip install --no-cache-dir -r requirements.txt
# Copy the application code and set ownership to appuser
COPY . .
# Change ownership of the application directory to appuser
RUN chown -R appuser:appuser /usr/src/app
# Switch to the non-root user
USER appuser
# Expose the application port
EXPOSE 7860
# Set environment variables
ENV GRADIO_SERVER_NAME="0.0.0.0"
CMD ["python", "app.py"]