Spaces:
Sleeping
Sleeping
Add application file
Browse files- Dockerfile +31 -0
- app.py +10 -0
- requirements.txt +4 -0
Dockerfile
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
7 |
+
# Switch to the new user
|
8 |
+
USER user
|
9 |
+
|
10 |
+
# Set an environment variable to add the local bin directory to the PATH
|
11 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
12 |
+
|
13 |
+
# Set the working directory inside the container to /app
|
14 |
+
WORKDIR /app
|
15 |
+
|
16 |
+
# Copy the requirements.txt file into the container, changing ownership to 'user'
|
17 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
18 |
+
|
19 |
+
# Install the dependencies listed in requirements.txt
|
20 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
21 |
+
|
22 |
+
# Copy the rest of the application code into the container, changing ownership to 'user'
|
23 |
+
COPY --chown=user . /app
|
24 |
+
|
25 |
+
# Set the Flask environment variables
|
26 |
+
ENV FLASK_APP=app.py
|
27 |
+
ENV FLASK_RUN_HOST=0.0.0.0
|
28 |
+
ENV FLASK_RUN_PORT=7860
|
29 |
+
|
30 |
+
# Specify the command to run the Flask application
|
31 |
+
CMD ["flask", "run"]
|
app.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask
|
2 |
+
|
3 |
+
app = Flask(__name__)
|
4 |
+
|
5 |
+
@app.route('/')
|
6 |
+
def hello_world():
|
7 |
+
return 'Hello, World!'
|
8 |
+
|
9 |
+
if __name__ == '__main__':
|
10 |
+
app.run(debug=True)
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
pandas==2.1.4
|
2 |
+
transformers==4.42.4
|
3 |
+
datasets==2.21.0
|
4 |
+
torch==2.3.1+cu121
|