Spaces:
Running
Running
Commit
·
cfa4af6
1
Parent(s):
0031a0c
fix adjustment
Browse files- Dockerfile +14 -2
- server.py +1 -1
Dockerfile
CHANGED
@@ -1,13 +1,25 @@
|
|
|
|
1 |
FROM python:3.11
|
2 |
|
|
|
3 |
RUN useradd -m -u 1000 user
|
4 |
USER user
|
|
|
|
|
5 |
ENV PATH="/home/user/.local/bin:$PATH"
|
6 |
|
|
|
7 |
WORKDIR /server
|
8 |
|
9 |
-
|
|
|
10 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
11 |
|
|
|
12 |
COPY --chown=user . /server
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use Python 3.11 as the base image
|
2 |
FROM python:3.11
|
3 |
|
4 |
+
# Create a non-root user
|
5 |
RUN useradd -m -u 1000 user
|
6 |
USER user
|
7 |
+
|
8 |
+
# Set the environment path for pip packages
|
9 |
ENV PATH="/home/user/.local/bin:$PATH"
|
10 |
|
11 |
+
# Set working directory
|
12 |
WORKDIR /server
|
13 |
|
14 |
+
# Copy and install dependencies
|
15 |
+
COPY --chown=user requirements.txt requirements.txt
|
16 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
17 |
|
18 |
+
# Copy all files to the container
|
19 |
COPY --chown=user . /server
|
20 |
+
|
21 |
+
# Expose Flask port
|
22 |
+
EXPOSE 7860
|
23 |
+
|
24 |
+
# Run Flask app
|
25 |
+
CMD ["python", "server.py"]
|
server.py
CHANGED
@@ -63,4 +63,4 @@ def query_llm():
|
|
63 |
return jsonify({"response": response})
|
64 |
|
65 |
if __name__ == '__main__':
|
66 |
-
app.run(host='0.0.0.0', port=
|
|
|
63 |
return jsonify({"response": response})
|
64 |
|
65 |
if __name__ == '__main__':
|
66 |
+
app.run(host='0.0.0.0', port=7860)
|