Spaces:
Sleeping
Sleeping
Upload Dockerfile
Browse files- Dockerfile +22 -0
Dockerfile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11
|
| 2 |
+
|
| 3 |
+
# Create a non-root user
|
| 4 |
+
RUN useradd -ms /bin/bash myuser
|
| 5 |
+
|
| 6 |
+
# Set the working directory
|
| 7 |
+
WORKDIR /code
|
| 8 |
+
|
| 9 |
+
# Copy the project files
|
| 10 |
+
COPY . .
|
| 11 |
+
|
| 12 |
+
# Install Python dependencies
|
| 13 |
+
RUN pip install flask requests
|
| 14 |
+
|
| 15 |
+
# Change ownership of the code directory to the non-root user
|
| 16 |
+
RUN chown -R myuser:myuser /code
|
| 17 |
+
|
| 18 |
+
# Switch to the non-root user
|
| 19 |
+
USER myuser
|
| 20 |
+
|
| 21 |
+
# Set the command to run your application
|
| 22 |
+
CMD ["python", "app.py"]
|