backup
This commit is contained in:
32
Dockerfile
32
Dockerfile
@@ -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"]
|
||||
Reference in New Issue
Block a user