Update Dockerfile
Browse files- Dockerfile +17 -22
Dockerfile
CHANGED
@@ -1,29 +1,24 @@
|
|
1 |
-
|
2 |
-
FROM python:3.10-slim
|
3 |
|
4 |
-
|
5 |
-
ENV PYTHONDONTWRITEBYTECODE=1
|
6 |
-
ENV PYTHONUNBUFFERED=1
|
7 |
|
8 |
-
#
|
9 |
-
|
|
|
10 |
|
11 |
-
#
|
12 |
-
RUN
|
13 |
-
|
14 |
-
libglib2.0-0 \
|
15 |
-
&& rm -rf /var/lib/apt/lists/*
|
16 |
|
17 |
-
#
|
18 |
-
|
19 |
-
|
20 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
21 |
|
22 |
-
|
23 |
-
COPY .
|
24 |
|
25 |
-
# Expose port
|
26 |
-
EXPOSE
|
27 |
|
28 |
-
#
|
29 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "
|
|
|
1 |
+
FROM python:3.10
|
|
|
2 |
|
3 |
+
WORKDIR /code
|
|
|
|
|
4 |
|
5 |
+
# Copy the correct file
|
6 |
+
COPY ./requirements.txt /code/requirements.txt
|
7 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
8 |
|
9 |
+
# Create and switch to a non-root user
|
10 |
+
RUN useradd -m user
|
11 |
+
USER user
|
|
|
|
|
12 |
|
13 |
+
# Environment variables
|
14 |
+
ENV HOME=/home/user \
|
15 |
+
PATH=/home/user/.local/bin:$PATH
|
|
|
16 |
|
17 |
+
WORKDIR $HOME/app
|
18 |
+
COPY --chown=user . $HOME/app
|
19 |
|
20 |
+
# Expose the port your app runs on
|
21 |
+
EXPOSE 7860
|
22 |
|
23 |
+
# Command to start the app
|
24 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|