Update Dockerfile
Browse files- Dockerfile +29 -0
Dockerfile
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.12
|
| 2 |
+
|
| 3 |
+
## set the working directory to /code
|
| 4 |
+
WORKDIR /code
|
| 5 |
+
|
| 6 |
+
## Copy the current directory contents in the container at /code
|
| 7 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 8 |
+
|
| 9 |
+
## Install the requirements.txt
|
| 10 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 11 |
+
|
| 12 |
+
# Set up a new user named "user"
|
| 13 |
+
RUN useradd user
|
| 14 |
+
# Switch to the "user" user
|
| 15 |
+
USER user
|
| 16 |
+
|
| 17 |
+
# Set home to the user's home directory
|
| 18 |
+
|
| 19 |
+
ENV HOME=/home/user \
|
| 20 |
+
PATH=/home/user/.local/bin:$PATH
|
| 21 |
+
|
| 22 |
+
# Set the working directory to the user's home directory
|
| 23 |
+
WORKDIR $HOME/app
|
| 24 |
+
|
| 25 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 26 |
+
COPY --chown=user . $HOME/app
|
| 27 |
+
|
| 28 |
+
## Start the FASTAPI App on port 7860
|
| 29 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
|