mirror of
https://github.com/wfg/docker-wireguard.git
synced 2025-12-20 00:15:42 +01:00
Update pipeline
This commit is contained in:
52
.github/workflows/build.yaml
vendored
52
.github/workflows/build.yaml
vendored
@@ -1,46 +1,44 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: 0 1 * * 2
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: docker/setup-qemu-action@v2
|
||||
- uses: docker/setup-buildx-action@v2
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: docker/login-action@v2
|
||||
- run: cat build_variables >> $GITHUB_ENV
|
||||
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
|
||||
- uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- id: tags
|
||||
uses: docker/metadata-action@v4
|
||||
- uses: docker/metadata-action@v5
|
||||
id: meta
|
||||
with:
|
||||
images: ghcr.io/wfg/wireguard
|
||||
images: ${{ env.IMAGE_NAME }}
|
||||
flavor: |
|
||||
latest=true
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
|
||||
type=sha,prefix=
|
||||
|
||||
- id: build-args
|
||||
run: |
|
||||
ref=${{ github.ref }}
|
||||
vpatch=${ref##refs/*/}
|
||||
patch=${vpatch#v}
|
||||
echo "::set-output name=date::$(date --utc --iso-8601=seconds)"
|
||||
echo "::set-output name=version::$patch"
|
||||
|
||||
- uses: docker/build-push-action@v3
|
||||
- uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: "{{defaultContext}}:build"
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
|
||||
context: build
|
||||
build-args: |
|
||||
BUILD_DATE=${{ steps.build-args.outputs.date }}
|
||||
IMAGE_VERSION=${{ steps.build-args.outputs.version }}
|
||||
tags: ${{ steps.tags.outputs.tags }}
|
||||
WGT_GIT_REF=${{ env.WGT_GIT_REF }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
push: true
|
||||
|
||||
1
.shellcheckrc
Normal file
1
.shellcheckrc
Normal file
@@ -0,0 +1 @@
|
||||
external-sources=true
|
||||
12
build.py
12
build.py
@@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import subprocess
|
||||
|
||||
|
||||
docker_build_cmd = [
|
||||
"docker", "build",
|
||||
"--pull", "--no-cache",
|
||||
"--tag", "ghcr.io/wfg/wireguard:latest",
|
||||
"./build",
|
||||
]
|
||||
subprocess.run(docker_build_cmd)
|
||||
8
build.sh
Executable file
8
build.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
source build_variables
|
||||
|
||||
docker build --pull \
|
||||
--build-arg "WGT_GIT_REF=${WGT_GIT_REF}" \
|
||||
--tag "${IMAGE_NAME}:latest" \
|
||||
build
|
||||
@@ -1 +1,2 @@
|
||||
.dockerignore
|
||||
Dockerfile
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FROM debian:bookworm-slim AS build
|
||||
|
||||
ARG GIT_REF=master
|
||||
ARG WGT_GIT_REF
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
@@ -8,7 +8,7 @@ RUN apt-get update \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN git clone --branch "$GIT_REF" --depth 1 https://git.zx2c4.com/wireguard-tools \
|
||||
RUN git clone --branch "$WGT_GIT_REF" --depth 1 https://git.zx2c4.com/wireguard-tools \
|
||||
&& make -C wireguard-tools/src \
|
||||
&& DESTDIR=build WITH_BASHCOMPLETION=no WITH_WGQUICK=yes WITH_SYSTEMDUNITS=no make -C wireguard-tools/src install
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ set -e
|
||||
|
||||
cleanup() {
|
||||
wg-quick down "$1"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Find a config file and isolate the interface name
|
||||
|
||||
2
build_variables
Normal file
2
build_variables
Normal file
@@ -0,0 +1,2 @@
|
||||
IMAGE_NAME=ghcr.io/wfg/wireguard
|
||||
WGT_GIT_REF=master
|
||||
Reference in New Issue
Block a user