pseudotheos
commited on
Commit
•
963b33c
1
Parent(s):
9ec22a8
Update Dockerfile
Browse files- Dockerfile +15 -6
Dockerfile
CHANGED
@@ -1,15 +1,24 @@
|
|
1 |
-
# Use
|
2 |
-
FROM python:3.9
|
|
|
|
|
|
|
|
|
3 |
|
4 |
# Set the working directory inside the container
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
#
|
8 |
-
COPY ./requirements.txt /app/
|
|
|
|
|
9 |
RUN pip install --no-cache-dir -r requirements.txt
|
10 |
|
11 |
-
# Copy
|
12 |
-
COPY . /app
|
|
|
|
|
|
|
13 |
|
14 |
# Specify the command to run your application
|
15 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.9-slim
|
3 |
+
|
4 |
+
# Create a non-root user
|
5 |
+
RUN useradd -m appuser
|
6 |
+
USER appuser
|
7 |
|
8 |
# Set the working directory inside the container
|
9 |
WORKDIR /app
|
10 |
|
11 |
+
# Copy the requirements file into the container at /app
|
12 |
+
COPY ./requirements.txt /app/
|
13 |
+
|
14 |
+
# Install the dependencies
|
15 |
RUN pip install --no-cache-dir -r requirements.txt
|
16 |
|
17 |
+
# Copy the current directory contents into the container at /app
|
18 |
+
COPY . /app/
|
19 |
+
|
20 |
+
# Create a writable cache directory
|
21 |
+
RUN mkdir -p /.cache && chmod -R 777 /.cache
|
22 |
|
23 |
# Specify the command to run your application
|
24 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|