parth parekh
commited on
Commit
Β·
928b9ca
1
Parent(s):
5efb178
added proper permissions
Browse files- Dockerfile +11 -2
Dockerfile
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
# Use an official Python image as a base
|
2 |
FROM python:3.12-slim
|
3 |
|
|
|
|
|
|
|
4 |
# Set the working directory inside the container
|
5 |
WORKDIR /app
|
6 |
|
@@ -8,11 +11,17 @@ WORKDIR /app
|
|
8 |
COPY requirements.txt .
|
9 |
RUN pip install --no-cache-dir -r requirements.txt
|
10 |
|
|
|
|
|
|
|
11 |
# Copy the rest of the application code
|
12 |
COPY . .
|
13 |
|
14 |
# Expose port 8000 for the FastAPI app
|
15 |
-
EXPOSE
|
|
|
|
|
|
|
16 |
|
17 |
# Run the FastAPI app with uvicorn
|
18 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "
|
|
|
1 |
# Use an official Python image as a base
|
2 |
FROM python:3.12-slim
|
3 |
|
4 |
+
# Create a new user
|
5 |
+
RUN useradd -m user
|
6 |
+
|
7 |
# Set the working directory inside the container
|
8 |
WORKDIR /app
|
9 |
|
|
|
11 |
COPY requirements.txt .
|
12 |
RUN pip install --no-cache-dir -r requirements.txt
|
13 |
|
14 |
+
# Change ownership of the application directory to the new user
|
15 |
+
RUN chown -R user:user /
|
16 |
+
|
17 |
# Copy the rest of the application code
|
18 |
COPY . .
|
19 |
|
20 |
# Expose port 8000 for the FastAPI app
|
21 |
+
EXPOSE 7860
|
22 |
+
|
23 |
+
# Switch to the new user
|
24 |
+
USER user
|
25 |
|
26 |
# Run the FastAPI app with uvicorn
|
27 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|