From cf6245a7317ec18ea8dad83fc9d36dcaf621a979 Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Mon, 9 Jun 2025 10:41:20 +0200 Subject: [PATCH] Switch reverse proxy to custom OpenResty Docker image, update paths in `docker-compose.yml` and `nginx.conf` --- Dockerfile-openresty | 6 ++++++ docker-compose.yml | 6 +++--- nginx.conf | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 Dockerfile-openresty diff --git a/Dockerfile-openresty b/Dockerfile-openresty new file mode 100644 index 0000000..bc152ad --- /dev/null +++ b/Dockerfile-openresty @@ -0,0 +1,6 @@ +FROM openresty/openresty:alpine + +RUN apk add --no-cache git curl luarocks \ + && luarocks install lua-resty-openidc \ + && luarocks install lua-resty-session \ + && luarocks install lua-cjson diff --git a/docker-compose.yml b/docker-compose.yml index f434ee2..8018ea4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,12 +1,12 @@ services: reverse-proxy: - image: ghcr.io/zmartzone/lua-resty-openidc:latest + build: Dockerfile-openresty container_name: demo-nginx-proxy ports: - "25700:80" volumes: - - ./nginx.conf:/etc/nginx/nginx.conf:ro - - ./auth.lua:/etc/nginx/auth.lua:ro + - ./nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf:ro + - ./auth.lua:/usr/local/openresty/nginx/conf/auth.lua:ro environment: - KEYCLOAK_CLIENT_SECRET=${KEYCLOAK_CLIENT_SECRET} env_file: diff --git a/nginx.conf b/nginx.conf index 5a6e499..53ee314 100644 --- a/nginx.conf +++ b/nginx.conf @@ -35,7 +35,7 @@ http { # Protected root route (main site) location / { - access_by_lua_file /etc/nginx/auth.lua; + access_by_lua_file /usr/local/openresty/nginx/conf/auth.lua; proxy_pass http://main-website:3000; proxy_set_header Host $host; @@ -46,7 +46,7 @@ http { # Protected demo route location /lawfirm/demo1/ { - access_by_lua_file /etc/nginx/auth.lua; + access_by_lua_file /usr/local/openresty/nginx/conf/auth.lua; rewrite ^/lawfirm/demo1(/.*)$ $1 break; proxy_pass http://ld1:3000;