-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
executable file
·37 lines (26 loc) · 1.04 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Use an official Python runtime as a parent image
FROM python:3.10-slim
# Install necessary networking tools
RUN apt-get update && apt-get install -y iputils-ping
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Create the saved_data directory and set correct permissions
RUN mkdir -p /home/user/app/saved_data && chown user:user /home/user/app/saved_data
# Switch to the "user" user
USER user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:/usr/local/bin:$PATH
# Set the working directory in the container
WORKDIR $HOME/app
# Copy the current directory contents into the container at $HOME/app
COPY --chown=user . $HOME/app
# Install Poetry
RUN python -m pip install --upgrade pip && \
pip install poetry
# Install dependencies using Poetry
RUN poetry install --no-root --only main
# Expose port 7860 for the FastAPI app
EXPOSE 7860
# Define the command to run the FastAPI app with Uvicorn
CMD ["poetry", "run", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]