From ebd39c63ea22a326cee73bf4eb1c1ff2f0731990 Mon Sep 17 00:00:00 2001 From: mhmdksh Date: Thu, 12 Sep 2024 14:48:24 +0400 Subject: [PATCH] initial commit --- .github/workflows/ci.yml | 29 +++++++++++++++++++++++++++++ Dockerfile | 11 +++++++++++ README.md | 28 +++++++++++++++++++++++++++- 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml create mode 100644 Dockerfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..201931a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: deploy-pipeline + +on: + push: + branches: + - main + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ghcr.io/generalmagicio/gm-caddy:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..30410dc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM caddy:2-builder-alpine AS builder + +RUN xcaddy build \ + --with github.com/mholt/caddy-ratelimit \ + --with github.com/porech/caddy-maxmind-geolocation \ + --with github.com/muety/caddy-remote-host \ + --with github.com/caddy-dns/godaddy + +FROM caddy:2-alpine + +COPY --from=builder /usr/bin/caddy /usr/bin/caddy diff --git a/README.md b/README.md index 46a622d..66a6004 100644 --- a/README.md +++ b/README.md @@ -1 +1,27 @@ -# gm-caddy \ No newline at end of file +# Caddy GM +We want a specific Caddy Web Server Image that works with our GM Deployments. We are using this as a migration from nginx. This is a +specific caddy build that supports the below: +1. Rate Limiting +2. GeoBlocking & Control +## Usage +You can find the docker-compose configuration snippet example here: +``` + caddy: + image: ghcr.io/generalmagicio/gm-caddy:latest + container_name: caddy + restart: unless-stopped + networks: + - mynetwork + ports: + - 80:80 + - 443:443 + env_file: + - .env + environment: + MY_URL = ${MY_URL:-} + IP_WHITELIST: ${IP_WHITELIST:-} + volumes: + - caddy_data:/data + - caddy_config:/config + - ./Caddyfile:/etc/caddy/Caddyfile +```