Spaces:
Running
Running
Create Dockerfile
Browse files- Dockerfile +30 -0
Dockerfile
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.11-slim-bullseye AS base
|
2 |
+
|
3 |
+
# Create a user for security
|
4 |
+
RUN useradd -m -u 1000 user
|
5 |
+
USER user
|
6 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
7 |
+
|
8 |
+
# Set working directory
|
9 |
+
WORKDIR /app
|
10 |
+
|
11 |
+
# Copy and install Python dependencies
|
12 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
13 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt || echo "No requirements.txt found, skipping."
|
14 |
+
|
15 |
+
# Copy application files
|
16 |
+
COPY --chown=user . /app
|
17 |
+
|
18 |
+
# Install Node.js separately
|
19 |
+
FROM node:20-slim AS nodebuilder
|
20 |
+
WORKDIR /app
|
21 |
+
COPY --from=base /app /app
|
22 |
+
|
23 |
+
# Install Node.js dependencies
|
24 |
+
RUN npm install --production
|
25 |
+
|
26 |
+
# Expose port 3000 for the website
|
27 |
+
EXPOSE 3000
|
28 |
+
|
29 |
+
# Start the Node.js server and optionally run Python bots
|
30 |
+
CMD ["/bin/bash", "-c", "node server.js & python3 bot1.py & python3 bot2.py"]
|