-
Notifications
You must be signed in to change notification settings - Fork 176
85 lines (80 loc) · 2.3 KB
/
dockerimage.yml
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Docker Image CI/CD
on:
push:
branches:
- master
paths:
- '*'
- '!README.md'
pull_request:
paths:
- '*'
- '!README.md'
env:
SE_VERSION: 4.41
SE_REVISION: 9782
jobs:
build:
name: Build Docker image
runs-on: ubuntu-latest
strategy:
matrix:
tag: [alpine, debian, ubuntu, opensuse]
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
-
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
-
name: Build Docker image for testing
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile.${{ matrix.tag }}
load: true
tags: vpn
-
name: Test IPsec connection
run: |
docker network create --subnet 172.18.0.0/16 test-ipsec
docker run -d --cap-add NET_ADMIN -e USERNAME=test -e PASSWORD=test --network test-ipsec --ip 172.18.0.3 vpn
sudo bash tests/prepare-ipsec.sh
sudo bash tests/test-ipsec.sh
-
name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: siomiz/softethervpn
tags: |
type=raw,value=${{ matrix.tag }}
type=raw,value=${{ env.SE_VERSION }}-${{ matrix.tag }}
type=raw,value=${{ env.SE_REVISION }}-${{ matrix.tag }}
type=raw,value=latest,enable=${{ matrix.tag == 'alpine' }}
type=raw,value=${{ env.SE_VERSION }},enable=${{ matrix.tag == 'alpine' }}
type=raw,value=${{ env.SE_REVISION }},enable=${{ matrix.tag == 'alpine' }}
-
name: Buildx and push Docker image
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: Dockerfile.${{ matrix.tag }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}