docker support
This commit is contained in:
21
APP_PROFILER/Dockerfile
Normal file
21
APP_PROFILER/Dockerfile
Normal file
@@ -0,0 +1,21 @@
|
||||
FROM python:3.12-alpine
|
||||
|
||||
# Install OpenVPN, OpenRC and other system deps
|
||||
RUN apk add --no-cache openvpn openrc iproute2 bash
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install Python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy source code and entrypoint
|
||||
COPY . .
|
||||
RUN chmod +x entrypoint.sh
|
||||
|
||||
# Expose API port
|
||||
EXPOSE 8000
|
||||
# Expose OpenVPN port (default 1194 UDP)
|
||||
EXPOSE 1194/udp
|
||||
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
||||
20
APP_PROFILER/entrypoint.sh
Normal file
20
APP_PROFILER/entrypoint.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
# EnsureTUN device exists
|
||||
if [ ! -c /dev/net/tun ]; then
|
||||
mkdir -p /dev/net
|
||||
mknod /dev/net/tun c 10 200
|
||||
chmod 600 /dev/net/tun
|
||||
fi
|
||||
|
||||
# Enable IP forwarding
|
||||
sysctl -w net.ipv4.ip_forward=1
|
||||
|
||||
# Start OpenRC (needed for rc-service if we use it, but better to start openvpn directly or via rc)
|
||||
# Since we are in Alpine, we can try to start the service if configured,
|
||||
# but Container 4 main.py might expect rc-service to work.
|
||||
openrc default
|
||||
|
||||
# Start the APP_PROFILER API
|
||||
# We use 0.0.0.0 to be reachable from other containers
|
||||
python main.py
|
||||
6
APP_PROFILER/requirements.txt
Normal file
6
APP_PROFILER/requirements.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
fastapi
|
||||
uvicorn
|
||||
sqlalchemy
|
||||
psutil
|
||||
python-multipart
|
||||
jinja2
|
||||
Reference in New Issue
Block a user