Skip to content

Commit 765a75b

Browse files
committed
[FEATURE] Add OpenVPN
0 parents  commit 765a75b

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed

.github/workflows/openvpn.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: OpenVPN
2+
3+
on:
4+
push:
5+
paths:
6+
- openvpn/**
7+
schedule:
8+
- cron: 0 0 * * *
9+
workflow_dispatch:
10+
11+
jobs:
12+
update:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
version: ${{ steps.version.outputs.version }}
16+
steps:
17+
- uses: docker/login-action@v1
18+
with:
19+
username: ${{ secrets.DOCKERHUB_USERNAME }}
20+
password: ${{ secrets.DOCKERHUB_TOKEN }}
21+
- id: version
22+
env:
23+
DOCKER_CLI_EXPERIMENTAL: enabled
24+
run: |
25+
export VERSION=$(curl https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | tar -Oxz | grep -FaxA1 "P:openvpn" | tail -n1 | cut -d: -f2)
26+
docker manifest inspect ${{ secrets.DOCKERHUB_USERNAME }}/openvpn:${VERSION} > /dev/null && echo "" || echo "::set-output name=version::${VERSION}"
27+
publish:
28+
needs: update
29+
if: ${{ needs.update.outputs.version }}
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v2
33+
- uses: docker/setup-qemu-action@v1
34+
- uses: docker/setup-buildx-action@v1
35+
- uses: docker/login-action@v1
36+
with:
37+
username: ${{ secrets.DOCKERHUB_USERNAME }}
38+
password: ${{ secrets.DOCKERHUB_TOKEN }}
39+
- uses: docker/build-push-action@v2
40+
with:
41+
build-args: |
42+
VERSION=${{ needs.update.outputs.version }}
43+
context: openvpn
44+
file: openvpn/Dockerfile
45+
platforms: |
46+
linux/amd64
47+
linux/arm64
48+
push: true
49+
tags: |
50+
${{ secrets.DOCKERHUB_USERNAME }}/openvpn
51+
${{ secrets.DOCKERHUB_USERNAME }}/openvpn:${{ needs.update.outputs.version }}

openvpn/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM alpine:edge
2+
3+
ARG VERSION
4+
5+
COPY rootfs/ /
6+
7+
RUN set -ex; \
8+
apk add --no-cache \
9+
iptables \
10+
ip6tables \
11+
openvpn="${VERSION}" \
12+
;
13+
14+
EXPOSE 1194
15+
EXPOSE 1194/udp
16+
17+
VOLUME [ "/etc/openvpn" ]
18+
19+
ENTRYPOINT [ "/sbin/init" ]

openvpn/rootfs/sbin/init

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
if [ ! -c "/dev/net/tun" ]; then
4+
mkdir -p "/dev/net"
5+
mknod "/dev/net/tun" c 10 200
6+
fi
7+
8+
exec $@

0 commit comments

Comments
 (0)