A (very) simple, text only chatbot using Society AI inference endpoint

Update Dockerfile
All checks were successful
society-ai-hub-container-cache Actions Demo / build (push) Successful in 26s

This commit is contained in:
Hezi Aharon 2024-11-02 06:41:57 +00:00
parent 89e699cb56
commit 9fb8817879

@ -1,27 +1,23 @@
# Use a slim base image to reduce potential vulnerabilities # Use a slim base image to reduce potential vulnerabilities
FROM python:3.10-slim-bookworm FROM python:3.10-slim-bookworm
# Create a non-root user and group # Create a non-root user and group with home directory set to /usr/src/app
RUN groupadd -r appuser && useradd --no-log-init -r -g appuser appuser RUN useradd --no-log-init -r -m -d /usr/src/app appuser
# Set the working directory # Set the working directory
WORKDIR /usr/src/app WORKDIR /usr/src/app
# Copy the requirements file and install the dependencies # Copy the requirements file and install the dependencies as root
COPY --chown=appuser:appuser requirements.txt . COPY requirements.txt .
# Install uv and the dependencies without caching to reduce image size
RUN pip install --no-cache-dir uv==0.4.28 && \ RUN pip install --no-cache-dir uv==0.4.28 && \
pip install --no-cache-dir -r requirements.txt pip install --no-cache-dir -r requirements.txt
# Copy the application code with appropriate ownership # Copy the application code and set ownership to appuser
COPY --chown=appuser:appuser . . COPY . .
# Adjust permissions of the application directory # Change ownership of the application directory to appuser
RUN chmod -R u+rwX,go-rwx /usr/src/app RUN chown -R appuser:appuser /usr/src/app
# Ensure parent directories are accessible
RUN chmod o+rx /usr /usr/src
# Switch to the non-root user # Switch to the non-root user
USER appuser USER appuser