-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
38 lines (31 loc) · 1.07 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Use the official Python image with a specific version
FROM python:3.9-slim
# Set the working directory
WORKDIR /app
# Copy the requirements file and source code
COPY requirements.txt ./
COPY . .
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Expose the port that Dash will run on
EXPOSE 5000
# Install supervisor
RUN apt-get update && apt-get install -y supervisor && rm -rf /var/lib/apt/lists/*
# Create supervisor configuration file
RUN echo "[supervisord]\n" \
"nodaemon=true\n\n" \
"[program:app]\n" \
"command=python3 dash_server.py\n" \
"autostart=true\n" \
"autorestart=true\n" \
"stdout_logfile=/var/log/app.log\n" \
"stderr_logfile=/var/log/app.err\n\n" \
"[program:main]\n" \
"command=python3 stock_scrapper.py\n" \
"autostart=true\n" \
"autorestart=true\n" \
"stdout_logfile=/var/log/main.log\n" \
"stderr_logfile=/var/log/main.err\n" \
> /etc/supervisor/conf.d/supervisord.conf
# Run supervisor to start both scripts
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]