# Use the specified Debian image | |
FROM docker.io/library/debian:latest | |
# Install OpenVPN and Easy-RSA | |
RUN apt-get update && \ | |
apt-get install -y openvpn easy-rsa iptables && \ | |
rm -rf /var/lib/apt/lists/* | |
# Set up configuration files and keys | |
COPY openvpn-server.conf /etc/openvpn/server.conf | |
# Initialize Easy-RSA PKI | |
RUN make-cadir /etc/openvpn/vars && \ | |
cd /etc/openvpn/vars && \ | |
. ./vars && \ | |
./clean-all && \ | |
./build-ca --batch && \ | |
./build-key-server --batch server && \ | |
./build-dh --batch | |
# Expose port 1194 for OpenVPN | |
EXPOSE 1194/udp | |
# Run OpenVPN server | |
CMD ["openvpn", "--config", "/etc/openvpn/server.conf"] |