This commit is contained in:
2025-05-17 20:46:55 +02:00
parent 91da4a5763
commit ce341fe360
4 changed files with 76 additions and 70 deletions

View File

@@ -1,21 +1,21 @@
FROM ubuntu:latest
# Use an official Python runtime as a parent image
FROM python:3.10
# Install dependencies
RUN apt update && apt install -y \
openvpn \
python3-pip \
protonvpn-cli \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory inside the container
WORKDIR /app
# Install dependencies if you have a requirements file
RUN pip install --no-cache-dir -r requirements.txt
# Ensure the directory exists
RUN mkdir -p /app
# Copy the Python script and monitoring script
COPY main.py /main.py
COPY vpn_monitor.sh /vpn_monitor.sh
# Copy the requirements file before copying the app files (for better caching)
COPY requirements.txt .
COPY main.py .
COPY Loader.py .
# Ensure scripts are executable
RUN chmod +x /main.py /vpn_monitor.sh
# Create and activate a virtual environment
RUN python -m venv venv && \
. venv/bin/activate && \
pip install --no-cache-dir -r requirements.txt
# Entry point: Start VPN and monitor status
CMD ["bash", "/vpn_monitor.sh"]
# Run the application using the virtual environment
CMD ["/bin/bash", "-c", "source venv/bin/activate && python main.py"]