Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +10 -21
Dockerfile
CHANGED
@@ -1,31 +1,20 @@
|
|
1 |
-
# Use
|
2 |
-
FROM
|
3 |
|
4 |
-
# Set the working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
# Copy
|
8 |
-
COPY package*.json ./
|
9 |
-
|
10 |
-
# Install dependencies - use npm install if package-lock.json doesn't exist
|
11 |
-
RUN npm install --omit=dev
|
12 |
-
|
13 |
-
# Copy the rest of the application code
|
14 |
COPY . .
|
15 |
|
16 |
-
#
|
17 |
-
RUN
|
18 |
-
RUN adduser -S nextjs -u 1001
|
19 |
-
|
20 |
-
# Change ownership of the app directory to the nodejs user
|
21 |
-
RUN chown -R nextjs:nodejs /app
|
22 |
-
USER nextjs
|
23 |
|
24 |
-
# Expose the port
|
25 |
EXPOSE 7860
|
26 |
|
27 |
-
#
|
28 |
ENV PORT=7860
|
29 |
|
30 |
-
# Start the
|
31 |
-
CMD ["
|
|
|
1 |
+
# Use official lightweight Python image
|
2 |
+
FROM python:3.11-slim
|
3 |
|
4 |
+
# Set the working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Copy requirements directly (you can also use a requirements.txt file instead)
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
COPY . .
|
9 |
|
10 |
+
# Install dependencies
|
11 |
+
RUN pip install --no-cache-dir Flask requests sse-starlette httpx
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
# Expose the port (e.g., 7860 for HF Spaces or your desired one)
|
14 |
EXPOSE 7860
|
15 |
|
16 |
+
# Environment variable (optional)
|
17 |
ENV PORT=7860
|
18 |
|
19 |
+
# Start the Python app
|
20 |
+
CMD ["python", "app.py"]
|