This commit is contained in:
harrispm 2025-03-13 21:07:15 -05:00
parent 05d3a4e55b
commit 57eae3c3ce
7 changed files with 70 additions and 2 deletions

View file

@ -0,0 +1,10 @@
FROM caddy:builder AS builder
RUN xcaddy build \
--with github.com/hslatman/caddy-crowdsec-bouncer \
--with github.com/mholt/caddy-events-exec \
--with github.com/lucaslorentz/caddy-docker-proxy/v2
FROM caddy:latest
COPY --from=builder /usr/bin/caddy /usr/bin/caddy

View file

@ -0,0 +1,19 @@
# Stage 1: Build Caddy with required plugins
FROM golang:latest AS builder
# Enable Go Modules and set Go proxy to avoid direct GitHub calls
ENV GO111MODULE=on
ENV GOPROXY=https://proxy.golang.org,direct
# Install xcaddy
RUN go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
# Build Caddy with required plugins
RUN xcaddy build \
--with github.com/lucaslorentz/caddy-docker-proxy/v2 \
--with github.com/crowdsecurity/caddy-bouncer/v2
# Stage 2: Create final lightweight image
FROM caddy:latest
# Copy built Caddy binary from builder stage
COPY --from=builder /go/bin/caddy /usr/bin/caddy

View file

@ -0,0 +1,20 @@
FROM golang:latest AS builder
# Enable Go Modules and force Go proxy usage
ENV GO111MODULE=on
ENV GOPROXY=https://proxy.golang.org,direct
# Install xcaddy
RUN go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
# Build Caddy with required plugins
RUN xcaddy build \
--with github.com/lucaslorentz/caddy-docker-proxy/v2 \
--with github.com/crowdsecurity/caddy-bouncer
# Create a lightweight final image
FROM caddy:latest
# Copy built Caddy binary from the builder stage
COPY --from=builder /go/bin/caddy /usr/bin/caddy

Binary file not shown.

View file

@ -0,0 +1,3 @@
module tempmod
go 1.24.1

16
Docker/Caddy/DockerFile Normal file
View file

@ -0,0 +1,16 @@
FROM golang:latest AS builder
# Install xcaddy
RUN go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
# Build Caddy with necessary plugins
RUN xcaddy build \
--with github.com/lucaslorentz/caddy-docker-proxy/v2 \
--with github.com/crowdsecurity/caddy-bouncer
# Create a lightweight final image
FROM caddy:latest
# Copy built Caddy binary from the builder stage
COPY --from=builder /go/bin/caddy /usr/bin/caddy

View file

@ -6,8 +6,8 @@ configs:
services:
caddy:
# image: lucaslorentz/caddy-docker-proxy:ci-alpine
image: ghcr.io/serfriz/caddy-crowdsec:latest
image: lucaslorentz/caddy-docker-proxy:ci-alpine
#image: ghcr.io/serfriz/caddy-crowdsec:latest
ports:
- 80:80
- 443:443