A (very) simple, text only chatbot using Society AI inference endpoint
Update Dockerfile
Some checks failed
society-ai-hub-container-cache Actions Demo / build (push) Failing after 56s
Some checks failed
society-ai-hub-container-cache Actions Demo / build (push) Failing after 56s
This commit is contained in:
parent
f7722366e5
commit
14588f55a8
28
Dockerfile
28
Dockerfile
@ -1,22 +1,36 @@
|
|||||||
# Stage 1: Build with dependencies
|
# Use a slim base image to reduce potential vulnerabilities
|
||||||
FROM python:3.10-bookworm
|
FROM python:3.10-slim-bookworm
|
||||||
|
|
||||||
# Set the working directory
|
# Set the working directory
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
RUN pip install uv==0.4.28
|
|
||||||
# Copy the requirements file and install the dependencies
|
# Copy the requirements file and install the dependencies
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
|
|
||||||
# Install the dependencies
|
# Install uv and the dependencies without caching to reduce image size
|
||||||
RUN export PYTHON=$(which python) && \
|
RUN pip install --no-cache-dir uv==0.4.28 && \
|
||||||
uv pip install -r ./requirements.txt --python $PYTHON
|
pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Copy the application code
|
# Copy the application code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Expose the port for the application
|
# Create a non-root user and group
|
||||||
|
RUN groupadd -r appuser && useradd --no-log-init -r -g appuser appuser
|
||||||
|
|
||||||
|
# Change ownership of the app directory to the new user
|
||||||
|
RUN chown -R appuser:appuser /usr/src/app
|
||||||
|
|
||||||
|
# Restrict permissions on all directories except /usr/src/app and /tmp
|
||||||
|
RUN chmod -R o-rwx / && \
|
||||||
|
chmod -R o+rx /usr/src/app /tmp
|
||||||
|
|
||||||
|
# Switch to the non-root user
|
||||||
|
USER appuser
|
||||||
|
|
||||||
|
# Expose the application port
|
||||||
EXPOSE 7860
|
EXPOSE 7860
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
||||||
|
|
||||||
# Run the application
|
# Run the application
|
||||||
|
Loading…
x
Reference in New Issue
Block a user