File size: 1,109 Bytes
2206dba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use a lightweight Python base image
FROM python:3.11-slim

# Set the working directory
WORKDIR /app

# Install the pvpn library, FastAPI, Uvicorn, and Supervisord
# Running as root for this step.
RUN apt-get update && \
    apt-get install -y supervisor && \
    pip install pvpn fastapi uvicorn python-multipart && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

# Ensure the working directory is writeable (though it is by default for root)
# This addresses the user's explicit request.
RUN chmod -R 777 /app

# The container will run as the default root user, which allows binding to 
# privileged ports 500 and 4500 without needing setcap.

# Copy the server scripts and supervisord config
# No need for --chown as we are running as root
COPY vpn_server.py web_ui.py supervisord.conf .

# Expose the standard IKEv2 ports (UDP 500 and 4500)
EXPOSE 500/udp
EXPOSE 4500/udp

# Expose the Web UI port (TCP 8000)
EXPOSE 8000/tcp

RUN useradd -m -u 1000 user
USER user
# Command to run Supervisord, which manages both the IKEv2 server and the Web UI
CMD ["/usr/bin/supervisord", "-c", "supervisord.conf"]