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
FROM python:3.10-slim-bookworm
# Create a non-root user and group
RUN groupadd -r appuser && useradd --no-log-init -r -g appuser appuser
# 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
COPY --chown=appuser:appuser requirements.txt .
# Copy the requirements file and install the dependencies as root
COPY requirements.txt .
# Install uv and the dependencies without caching to reduce image size
RUN pip install --no-cache-dir uv==0.4.28 && \
pip install --no-cache-dir -r requirements.txt
# Copy the application code with appropriate ownership
COPY --chown=appuser:appuser . .
# Copy the application code and set ownership to appuser
COPY . .
# Adjust permissions of the application directory
RUN chmod -R u+rwX,go-rwx /usr/src/app
# Ensure parent directories are accessible
RUN chmod o+rx /usr /usr/src
# Change ownership of the application directory to appuser
RUN chown -R appuser:appuser /usr/src/app
# Switch to the non-root user
USER appuser