-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·37 lines (28 loc) · 1.14 KB
/
Dockerfile
File metadata and controls
executable file
·37 lines (28 loc) · 1.14 KB
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
FROM httpd:2.4
# Install necessary packages
RUN apt-get update && apt-get install -y \
python3 python3-pip python3-venv python3-dev \
libffi-dev build-essential sudo supervisor \
&& rm -rf /var/lib/apt/lists/*
# Set up sudo permissions
RUN echo "Defaults:www-data !requiretty" >> /etc/sudoers && \
echo "www-data ALL=(ALL) NOPASSWD: /usr/bin/python3" >> /etc/sudoers && \
chmod 440 /etc/sudoers
# Enable CGI
RUN sed -i \
-e 's/#LoadModule cgid_module/LoadModule cgid_module/' \
-e 's/#AddHandler cgi-script .cgi/AddHandler cgi-script .cgi .py/' \
/usr/local/apache2/conf/httpd.conf
# Set up python CGI wrapper
RUN echo '#!/bin/sh\nsudo /usr/bin/python3 "$@"' > /usr/local/bin/python3-cgi && \
chmod +x /usr/local/bin/python3-cgi
# Create virtual environment
RUN python3 -m venv /opt/venv
# Install Python packages
RUN /opt/venv/bin/pip install websockets
# Install Flask and requests for save_leads.py
RUN /opt/venv/bin/pip install flask requests
# Copy the supervisor config
COPY supervisord.conf /etc/supervisord.conf
# Start both services using supervisord
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]