KN123/nl2sql-api
1
1FROM python:3.9
2
3# Set working directory
4WORKDIR /code
5
6# Copy requirements file and install dependencies
7COPY ./requirements.txt /code/requirements.txt
8RUN pip install --no-cache-dir --upgrade -r requirements.txt
9
10# Create a non-root user
11RUN useradd user
12
13# Set environment variables
14ENV HOME=/home/user \
15 PATH=/home/user/.local/bin:$PATH
16
17# Switch to the non-root user
18USER user
19
20# Set working directory for the application
21WORKDIR $HOME/app
22
23# Copy application code into the container
24COPY --chown=user . $HOME/app
25
26# Expose port
27EXPOSE 7860
28
29# Command to run the FastAPI application using uvicorn
30CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
31 