Spaces:
Sleeping
Sleeping
req and dockerfile
Browse files- Dockerfile +29 -0
- requirements.txt +2 -0
Dockerfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use the official Python 3.9 image from the Docker Hub
|
| 2 |
+
FROM python:3.10.12
|
| 3 |
+
|
| 4 |
+
# Create a new user with the username 'user' and a user ID of 1000
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
# Switch to the new user
|
| 7 |
+
USER user
|
| 8 |
+
# Set an environment variable to add the local bin directory to the PATH
|
| 9 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 10 |
+
|
| 11 |
+
# Set the working directory inside the container to /app
|
| 12 |
+
WORKDIR /app
|
| 13 |
+
|
| 14 |
+
# Copy the requirements.txt file into the container, changing ownership to 'user'
|
| 15 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
| 16 |
+
|
| 17 |
+
# Install the dependencies listed in requirements.txt
|
| 18 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 19 |
+
|
| 20 |
+
# Copy the rest of the application code into the container, changing ownership to 'user'
|
| 21 |
+
COPY --chown=user . /app
|
| 22 |
+
|
| 23 |
+
# Set the Flask environment variables
|
| 24 |
+
ENV FLASK_APP=app.py
|
| 25 |
+
ENV FLASK_RUN_HOST=0.0.0.0
|
| 26 |
+
ENV FLASK_RUN_PORT=7860
|
| 27 |
+
|
| 28 |
+
# Specify the command to run the Flask application
|
| 29 |
+
CMD ["flask", "run"]
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
flask
|
| 2 |
+
requests
|