pseudotheos
commited on
Commit
•
716770e
1
Parent(s):
046756f
Update Dockerfile
Browse files- Dockerfile +9 -7
Dockerfile
CHANGED
@@ -4,24 +4,26 @@ FROM python:3.9-slim
|
|
4 |
# Set the working directory inside the container
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
# Copy the requirements file into the container at /app
|
8 |
-
COPY ./requirements.txt /app/
|
9 |
-
|
10 |
# Create a non-root user
|
11 |
RUN useradd -m appuser
|
12 |
|
|
|
|
|
|
|
13 |
# Grant necessary permissions to the non-root user
|
14 |
RUN chown -R appuser /app /usr/local/
|
15 |
|
16 |
# Add uvicorn to the PATH and specify the command to run your application
|
17 |
ENV PATH="/home/appuser/.local/bin:${PATH}"
|
18 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
19 |
-
|
20 |
-
# Switch to the non-root user
|
21 |
-
USER appuser
|
22 |
|
23 |
# Copy the current directory contents into the container at /app
|
24 |
COPY . /app/
|
25 |
|
26 |
# Create a writable cache directory inside the /app directory
|
27 |
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
# Set the working directory inside the container
|
5 |
WORKDIR /app
|
6 |
|
|
|
|
|
|
|
7 |
# Create a non-root user
|
8 |
RUN useradd -m appuser
|
9 |
|
10 |
+
# Copy the requirements file into the container at /app
|
11 |
+
COPY ./requirements.txt /app/
|
12 |
+
|
13 |
# Grant necessary permissions to the non-root user
|
14 |
RUN chown -R appuser /app /usr/local/
|
15 |
|
16 |
# Add uvicorn to the PATH and specify the command to run your application
|
17 |
ENV PATH="/home/appuser/.local/bin:${PATH}"
|
|
|
|
|
|
|
|
|
18 |
|
19 |
# Copy the current directory contents into the container at /app
|
20 |
COPY . /app/
|
21 |
|
22 |
# Create a writable cache directory inside the /app directory
|
23 |
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
|
24 |
+
|
25 |
+
# Switch to the non-root user
|
26 |
+
USER appuser
|
27 |
+
|
28 |
+
# Specify the command to run your application
|
29 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|