mirror of
https://github.com/mempool/mempool.git
synced 2026-08-13 12:33:11 +02:00
Add nginx config validation workflow
This commit is contained in:
parent
01207ceb7b
commit
59f9272446
3 changed files with 61 additions and 0 deletions
16
.github/nginx-check/Dockerfile.docker
vendored
Normal file
16
.github/nginx-check/Dockerfile.docker
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
FROM nginx:1.30.1-alpine
|
||||
|
||||
# Validate the config set loaded by the mempool/frontend docker image.
|
||||
# Build context: repo root
|
||||
COPY nginx.conf http-basic.conf /etc/nginx/
|
||||
COPY nginx-mempool.conf /etc/nginx/conf.d/
|
||||
|
||||
# Replay the transforms applied by docker/init.sh (with the default values
|
||||
# docker/frontend/entrypoint.sh substitutes at container start)
|
||||
RUN sed -i \
|
||||
-e "s!127.0.0.1:80!0.0.0.0:8080!g" \
|
||||
-e "s!user nobody;!!g" \
|
||||
-e "s!/etc/nginx/nginx-mempool.conf!/etc/nginx/conf.d/nginx-mempool.conf!g" \
|
||||
/etc/nginx/nginx.conf
|
||||
|
||||
CMD ["nginx", "-t"]
|
||||
13
.github/nginx-check/Dockerfile.production
vendored
Normal file
13
.github/nginx-check/Dockerfile.production
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
FROM nginx:1.30.1-alpine
|
||||
|
||||
# Stage the config the way production/install does: the repo is available at
|
||||
# ${NGINX_ETC_FOLDER}/mempool and production/nginx/nginx.conf becomes the main
|
||||
# config, with __NGINX_USER__ and __NGINX_ETC_FOLDER__ substituted.
|
||||
# Build context: production/
|
||||
COPY nginx /etc/nginx/mempool/production/nginx
|
||||
|
||||
RUN cp /etc/nginx/mempool/production/nginx/nginx.conf /etc/nginx/nginx.conf && \
|
||||
sed -i "s!__NGINX_USER__!nginx!" /etc/nginx/nginx.conf && \
|
||||
sed -i "s!__NGINX_ETC_FOLDER__!/etc/nginx!" /etc/nginx/nginx.conf
|
||||
|
||||
CMD ["nginx", "-t"]
|
||||
32
.github/workflows/server-config.yml
vendored
Normal file
32
.github/workflows/server-config.yml
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
name: Validate server config
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
paths:
|
||||
- "nginx.conf"
|
||||
- "http-basic.conf"
|
||||
- "nginx-mempool.conf"
|
||||
- "production/nginx/**"
|
||||
- ".github/nginx-check/**"
|
||||
- ".github/workflows/server-config.yml"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
check_config:
|
||||
runs-on: "ubuntu-latest"
|
||||
|
||||
name: Validate nginx config
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
|
||||
|
||||
- name: Validate the production nginx config
|
||||
run: |
|
||||
docker run --rm $(docker build -q -f .github/nginx-check/Dockerfile.production production)
|
||||
|
||||
- name: Validate the docker frontend nginx config
|
||||
run: |
|
||||
docker run --rm $(docker build -q -f .github/nginx-check/Dockerfile.docker .)
|
||||
Loading…
Add table
Add a link
Reference in a new issue