forked from Ulexus/traefik-plugin-geoblock
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
251 additions
and
31 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: publish-container | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 | ||
with: | ||
images: | | ||
ghcr.io/tkhq/traefik-plugin-geoblock | ||
tags: | | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=sha,format=long | ||
- name: Get committer date | ||
run: | | ||
echo "committer_date=$(git log -1 --pretty=%ct)" >> "$GITHUB_ENV" | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | ||
- name: Login to GHCR | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 | ||
with: | ||
context: . | ||
platforms: linux/amd64 | ||
file: deploy/Dockerfile | ||
build-args: | | ||
SOURCE_DATE_EPOCH=${{ env.committer_date }} | ||
provenance: "false" | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
displayName: geoblock | ||
type: middleware | ||
import: github.com/nscuro/traefik-plugin-geoblock | ||
summary: traefik plugin to whitelist requests based on geolocation | ||
summary: traefik plugin to block or allow requests based on geolocation | ||
testData: | ||
# It doesn't appear to be possible to get the pilot plugin analyzer | ||
# to load local files. To prevent errors, the plugin is disabled here. | ||
# This will cause the plugin to not attempt to load the database file. | ||
enabled: false | ||
# databaseFilePath: IP2LOCATION-LITE-DB1.IPV6.BIN | ||
# allowedCountries: [ "CH", "DE" ] | ||
# blockedCountries: [ "RU" ] | ||
# defaultAllow: false | ||
# allowPrivate: true | ||
# disallowedStatusCode: 403 | ||
# allowedIPBlocks: ["66.249.64.0/19"] | ||
# allowedIPBlocks: ["66.249.64.0/19"] | ||
# blockedIPBlocks: ["66.249.64.0/24"] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM busybox@sha256:023917ec6a886d0e8e15f28fb543515a5fcd8d938edb091e8147db4efed388ee | ||
|
||
LABEL org.opencontainers.image.source https://github.com/tkhq/traefik-plugin-geoblock | ||
|
||
RUN mkdir /dist | ||
|
||
COPY go.mod /dist/ | ||
COPY go.sum /dist/ | ||
COPY .traefik.yml /dist/ | ||
COPY LICENSE /dist/ | ||
COPY plugin.go /dist/ | ||
COPY plugin.go /dist/ | ||
COPY vendor /dist/ | ||
|
||
COPY deploy/install.sh / | ||
|
||
ENTRYPOINT ["/install.sh"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# Copy this plugin to where Traefik is expecting it | ||
mkdir -p /plugins-local/src/github.com/nscuro/traefik-plugin-geoblock | ||
cp -R /dist/* /plugins-local/src/github.com/nscuro/traefik-plugin-geoblock/ | ||
cp /dist/.traefik.yml /plugins-local/src/github.com/nscuro/traefik-plugin-geoblock/ |
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
Oops, something went wrong.