Skip to content

Commit

Permalink
Merge pull request #70 from GSA-TTS/update-caddy
Browse files Browse the repository at this point in the history
Update caddy to 2.8
  • Loading branch information
rahearn authored Sep 26, 2024
2 parents 1fa30fc + 67bd83b commit f939e11
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
- name: build caddy - xcaddy build
run: >
xcaddy build
--with github.com/hairyhenderson/caddy-teapot-module@v0.0.3-0
--with github.com/caddyserver/forwardproxy@caddy2
--output proxy/caddy
- name: validate Caddyfile
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# See "Adding custom Caddy modules" here:
# https://hub.docker.com/_/caddy

FROM caddy:2.7-builder AS builder
FROM caddy:2.8-builder AS builder

ARG GOARCH=amd64
RUN xcaddy build \
--with github.com/caddyserver/forwardproxy@caddy2

FROM caddy:2.7-alpine
FROM caddy:2.8-alpine

RUN apk update
RUN apk upgrade
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Build the caddy binary and copy it into the proxy subdirectory
caddy-v2-with-forwardproxy: Dockerfile proxy/Caddyfile
docker compose build
docker compose up -d
docker compose cp caddy:/usr/bin/caddy proxy/caddy
docker compose up -d
- docker compose cp caddy:/usr/bin/caddy proxy/caddy
docker compose down

validate:
echo "test.gov" > allow.acl
echo "test.com" > deny.acl
sed -i 's/tls cert.pem key.pem/# tls cert.pem key.pem/g' proxy/Caddyfile
sed -i.bak 's/tls cert.pem key.pem/# tls cert.pem key.pem/g' proxy/Caddyfile && rm proxy/Caddyfile.bak
PORT=9999 PROXY_USERNAME=admin PROXY_PASSWORD=pass PROXY_PORTS=443 ./proxy/caddy validate --config proxy/Caddyfile
sed -i 's/# tls cert.pem key.pem/tls cert.pem key.pem/g' proxy/Caddyfile
rm allow.acl deny.acl
sed -i.bak 's/# tls cert.pem key.pem/tls cert.pem key.pem/g' proxy/Caddyfile
rm proxy/Caddyfile.bak allow.acl deny.acl
4 changes: 1 addition & 3 deletions docker-compose.yml → compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
---
version: "3.7"

services:
caddy:
build:
Expand All @@ -22,6 +19,7 @@ services:
# The variables that matter to the app
- PROXY_USERNAME=user
- PROXY_PASSWORD=pass
- PROXY_PORTS=443
- PROXY_DENY="*.yahoo.com"
- PROXY_ALLOW= |
"*.google.com
Binary file modified proxy/caddy
Binary file not shown.

0 comments on commit f939e11

Please sign in to comment.