* Initial

* Fixes

* Ignore hadolint DL3023 rule

* Ignore DL3022 rule

* Bump wireguard-tools

* Fix port value
This commit is contained in:
Pavel Popov 2022-05-05 01:13:32 +03:00 committed by GitHub
parent 62b266e182
commit 4e30cf81ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 171 additions and 0 deletions

10
.github/renovate.json5 vendored Normal file
View file

@ -0,0 +1,10 @@
{
extends: ["config:base"],
dependencyDashboard: false,
packageRules: [
{
matchUpdateTypes: ["minor", "patch", "pin", "digest"],
automerge: true,
},
],
}

16
.github/workflows/autorelease.yml vendored Normal file
View file

@ -0,0 +1,16 @@
name: Release
on:
push:
tags:
- "v[0-9].*.*"
jobs:
build:
runs-on: ubuntu-latest
name: Build image
steps:
- name: 🚀 Release new version
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true

24
.github/workflows/autotag.yml vendored Normal file
View file

@ -0,0 +1,24 @@
name: Auto-create new tag
on:
push:
branches:
- main
paths:
- "Dockerfile"
- "tailscale.sh"
jobs:
auto-tag:
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
- name: 🏷 Create new tag
uses: valitydev/action-autotag@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}

53
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,53 @@
name: Build
on:
pull_request:
branches:
- "*"
push:
tags:
- "v[0-9].*.*"
jobs:
build:
runs-on: ubuntu-latest
name: Build image
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@v3
- name: 🏗 Set up QEMU
uses: docker/setup-qemu-action@v1
- name: 🏗 Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: 🪄 Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=pr
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
- name: 🔓 Registry login
if: github.event_name == 'push'
uses: docker/login-action@v1.14.1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🛠️ Build image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.event_name == 'push' }}

44
.github/workflows/lint.yml vendored Normal file
View file

@ -0,0 +1,44 @@
name: Lint
on:
pull_request:
branches:
- main
jobs:
yamllint:
name: yamllint
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code
uses: actions/checkout@v3
- name: 🚀 Run yamllint
uses: reviewdog/action-yamllint@v1
with:
filter_mode: added
yamllint_flags: ". --no-warnings"
hadolint:
name: hadolint
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code
uses: actions/checkout@v3
- name: 🚀 Run hadolint
uses: reviewdog/action-hadolint@v1
with:
filter_mode: added
shellcheck:
name: shellcheck
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code
uses: actions/checkout@v3
- name: 🚀 Run shellcheck
uses: reviewdog/action-shellcheck@v1
with:
filter_mode: added

15
Dockerfile Normal file
View file

@ -0,0 +1,15 @@
FROM weejewel/wg-easy:5
# hadolint ignore=DL3022,DL3023
COPY --from=mindflavor/prometheus-wireguard-exporter:3.5.1 /usr/local/bin/prometheus_wireguard_exporter /usr/local/bin/
RUN apk add -U --no-cache \
wireguard-tools=1.0.20210914-r0
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
EXPOSE 9586/tcp
ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["/usr/bin/dumb-init", "node", "server.js"]

9
entrypoint.sh Normal file
View file

@ -0,0 +1,9 @@
#!/bin/bash
/usr/local/bin/prometheus_wireguard_exporter -n /etc/wireguard/wg0.conf &
exec "$@" &
wait -n
exit $?