Spaces:
Sleeping
Sleeping
Commit ·
9b06bd3
1
Parent(s): db06678
chore: update Dockerfile
Browse files- Dockerfile +24 -12
Dockerfile
CHANGED
|
@@ -1,17 +1,29 @@
|
|
| 1 |
-
|
| 2 |
-
FROM python:3.8-slim-buster
|
| 3 |
|
| 4 |
-
# Set
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10.13-slim-bookworm
|
|
|
|
| 2 |
|
| 3 |
+
# Set environment variables
|
| 4 |
+
ENV HOME=/home/user \
|
| 5 |
+
PATH=/home/user/.local/bin:$PATH
|
| 6 |
|
| 7 |
+
# Setup new user named user with UID 1000
|
| 8 |
+
RUN useradd -m -u 1000 user
|
| 9 |
|
| 10 |
+
# Define working directory
|
| 11 |
+
WORKDIR $HOME/app
|
| 12 |
|
| 13 |
+
# Switch to user
|
| 14 |
+
USER user
|
| 15 |
|
| 16 |
+
# Copy the requirements file
|
| 17 |
+
COPY --chown=user:user requirements.txt $HOME/app
|
| 18 |
+
|
| 19 |
+
# Install the requirements
|
| 20 |
+
RUN pip install -r requirements.txt
|
| 21 |
+
|
| 22 |
+
# Copy the rest of the files
|
| 23 |
+
COPY --chown=user:user . $HOME/app
|
| 24 |
+
|
| 25 |
+
# Expose the port
|
| 26 |
+
EXPOSE 7860/tcp
|
| 27 |
+
|
| 28 |
+
# Run the application
|
| 29 |
+
ENTRYPOINT ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|