commit 9bc7660e656a26dac775e20922e3d3198298e5cb Author: redxef Date: Sat Aug 7 18:24:20 2021 +0200 Init commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cbb59e6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +config.ovpn +auth.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..53ae9c6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM alpine:latest + +RUN apk add bash openvpn openresolv +ADD https://raw.githubusercontent.com/alfredopalhares/openvpn-update-resolv-conf/master/update-resolv-conf.sh \ + /etc/openvpn/update-resolv-conf +COPY start-openvpn.sh /usr/local/bin/start-openvpn.sh +RUN chmod +x /etc/openvpn/update-resolv-conf +RUN chmod +x /usr/local/bin/start-openvpn.sh +ENTRYPOINT [ "start-openvpn.sh" ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c50e9a0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3.3' +services: + openvpn: + restart: never + build: + context: ./ + dockerfile: Dockerfile + volumes: + - ./config.ovpn:/opt/config.ovpn + - ./auth.txt:/opt/auth.txt + cap_add: + - NET_ADMIN diff --git a/start-openvpn.sh b/start-openvpn.sh new file mode 100644 index 0000000..3429ded --- /dev/null +++ b/start-openvpn.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env sh + +create_net_dev() { + mkdir -p /dev/net + mknod /dev/net/tun c 10 200 + chmod 600 /dev/net/tun +} + +create_net_dev +"$@"