Spaces:
Sleeping
Sleeping
Merge remote-tracking branch 'origin/main'
Browse files- Dockerfile +18 -15
- README.md +1 -0
- app.py +21 -5
- requirements.txt +4 -2
Dockerfile
CHANGED
@@ -1,27 +1,30 @@
|
|
1 |
# Use an official Python runtime as a parent image
|
2 |
-
FROM python:3.
|
3 |
|
4 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
ENV PYTHONDONTWRITEBYTECODE=1
|
6 |
ENV PYTHONUNBUFFERED=1
|
7 |
|
8 |
-
# Create a non-root user to run the app
|
9 |
-
RUN useradd -m -u 1000 appuser
|
10 |
-
USER appuser
|
11 |
-
|
12 |
# Set the working directory
|
13 |
WORKDIR /app
|
14 |
|
15 |
# Copy and install dependencies
|
16 |
-
COPY --chown=
|
17 |
-
RUN pip install --no-cache-dir --upgrade pip
|
18 |
-
|
19 |
|
20 |
-
# Copy the application code
|
21 |
-
COPY --chown=
|
22 |
|
23 |
-
# Expose the port
|
24 |
-
EXPOSE
|
25 |
|
26 |
-
#
|
27 |
-
CMD ["
|
|
|
1 |
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.10-slim
|
3 |
|
4 |
+
# Create a user with a non-root UID
|
5 |
+
RUN useradd -m -u 1000 user
|
6 |
+
|
7 |
+
# Switch to the non-root user
|
8 |
+
USER user
|
9 |
+
|
10 |
+
# Set environment variables
|
11 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
12 |
ENV PYTHONDONTWRITEBYTECODE=1
|
13 |
ENV PYTHONUNBUFFERED=1
|
14 |
|
|
|
|
|
|
|
|
|
15 |
# Set the working directory
|
16 |
WORKDIR /app
|
17 |
|
18 |
# Copy and install dependencies
|
19 |
+
COPY --chown=user: /app/requirements.txt .
|
20 |
+
RUN pip install --no-cache-dir --upgrade pip
|
21 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
22 |
|
23 |
+
# Copy the rest of the application code
|
24 |
+
COPY --chown=user: /app /app
|
25 |
|
26 |
+
# Expose the port your app runs on
|
27 |
+
EXPOSE 8080
|
28 |
|
29 |
+
# Define the command to run the app using Gunicorn
|
30 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "app:app"]
|
README.md
CHANGED
@@ -7,6 +7,7 @@ sdk: docker
|
|
7 |
pinned: false
|
8 |
license: apache-2.0
|
9 |
short_description: Ultimate Website URL AI Manager
|
|
|
10 |
---
|
11 |
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
7 |
pinned: false
|
8 |
license: apache-2.0
|
9 |
short_description: Ultimate Website URL AI Manager
|
10 |
+
app_port: 8080
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
@@ -1,7 +1,23 @@
|
|
1 |
-
from
|
2 |
|
3 |
-
app =
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask, render_template, request, jsonify
|
2 |
|
3 |
+
app = Flask(__name__)
|
4 |
|
5 |
+
# Sample route for homepage
|
6 |
+
@app.route('/')
|
7 |
+
def home():
|
8 |
+
return "Welcome to LinkMaster!"
|
9 |
+
|
10 |
+
# Example route to manage tags
|
11 |
+
@app.route('/tags', methods=['GET', 'POST'])
|
12 |
+
def manage_tags():
|
13 |
+
if request.method == 'POST':
|
14 |
+
# Logic to add a new tag
|
15 |
+
pass
|
16 |
+
else:
|
17 |
+
# Logic to retrieve tags
|
18 |
+
return jsonify({"tags": []})
|
19 |
+
|
20 |
+
# Add more routes as needed for your application
|
21 |
+
|
22 |
+
if __name__ == '__main__':
|
23 |
+
app.run(host='0.0.0.0', port=8080)
|
requirements.txt
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
|
|
1 |
sqlalchemy
|
2 |
-
fastapi
|
3 |
-
uvicorn[standard]
|
|
|
1 |
+
gunicorn==20.1.0
|
2 |
+
flask
|
3 |
+
flask_cors
|
4 |
+
flask_sqlalchemy
|
5 |
sqlalchemy
|
|
|
|