5.02.5185 #53
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI/CD | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- '*' | |
- '!README.md' | |
pull_request: | |
paths: | |
- '*' | |
- '!README.md' | |
env: | |
SE_VERSION: 5.02.5185 | |
jobs: | |
build: | |
name: Build Docker image | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
tag: [alpine] | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
- | |
name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Build Docker image for testing | |
uses: docker/build-push-action@v6 | |
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@v3 | |
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=${{ env.SE_VERSION }}-${{ matrix.tag }} | |
type=raw,value=${{ env.SE_VERSION }},enable=${{ matrix.tag == 'alpine' }} | |
- | |
name: Buildx and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
file: Dockerfile.${{ matrix.tag }} | |
platforms: linux/amd64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |