Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions build/ubi/Dockerfile.nginx
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,17 @@ RUN --mount=type=bind,from=nginx-files,src=nginx_signing.key,target=/tmp/nginx_s
&& rm -rf /var/cache/yum

# Configure directories and logging
RUN mkdir -p /usr/lib/nginx/modules /var/run/nginx /usr/lib64/nginx/modules \
RUN mkdir -p /var/run/nginx /usr/lib64/nginx/modules \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not to make /usr/lib64/nginx/modules env variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand.
If we set /usr/lib64/nginx/modules as an env variable (e.g. export LIB_DIR=/usr/lib64/nginx/modules ) does that mean we can avoid making the directory?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, just having it to edit in one place

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it should be an ENV var because then it's technically over writable at build time which is not what we want here. It's correct to be explicit here - and anyway it's only specified in the file twice.

# Forward request and error logs to docker log collector
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
&& cp /usr/lib64/nginx/modules/ngx_* /usr/lib/nginx/modules/
&& ln -sf /dev/stderr /var/log/nginx/error.log

# Set proper permissions for nginx user
RUN chown -R 101:1001 /etc/nginx /var/cache/nginx

# Copy configuration files and scripts
COPY build/entrypoint.sh /agent/entrypoint.sh
COPY ${NJS_DIR}/ /usr/lib/nginx/modules/njs/
COPY ${NJS_DIR}/ /usr/lib64/nginx/modules/njs/
COPY ${NGINX_CONF_DIR}/nginx.conf /etc/nginx/nginx.conf
COPY ${NGINX_CONF_DIR}/grpc-error-locations.conf /etc/nginx/grpc-error-locations.conf
COPY ${NGINX_CONF_DIR}/grpc-error-pages.conf /etc/nginx/grpc-error-pages.conf
Expand Down
14 changes: 6 additions & 8 deletions build/ubi/Dockerfile.nginxplus
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ RUN --mount=type=bind,from=nginx-files,src=nginx-plus.repo,target=/etc/yum.repos
--mount=type=bind,from=ubi9-packages,src=/,target=/ubi-bin/ \
--mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode=0644 \
--mount=type=secret,id=nginx-repo.key,dst=/etc/ssl/nginx/nginx-repo.key,mode=0644 \
# Install shadow-utils for useradd and subscription-manager for repo access
microdnf --nodocs install -y shadow-utils subscription-manager \
# Install shadow-utils for useradd
microdnf --nodocs install -y shadow-utils \
&& rpm --import /tmp/nginx_signing.key \
# Install c-ares from the dependencies image (contains required libs)
&& rpm -Uvh /ubi-bin/c-ares-*.rpm \
Expand All @@ -50,17 +50,15 @@ RUN --mount=type=bind,from=nginx-files,src=nginx-plus.repo,target=/etc/yum.repos
# Install nginx-agent
&& microdnf --nodocs install -y nginx-agent-${NGINX_AGENT_VERSION#v}* \
# Clean up
&& microdnf remove -y shadow-utils subscription-manager \
&& microdnf remove -y shadow-utils \
&& microdnf clean all \
&& rm -rf /var/cache/yum

# Configure directories and logging
RUN mkdir -p /usr/lib/nginx/modules /var/run/nginx /usr/lib64/nginx/modules \
RUN mkdir -p /var/run/nginx /usr/lib64/nginx/modules \
# Forward request and error logs to docker log collector
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
&& cp /usr/lib64/nginx/modules/ngx_* /usr/lib/nginx/modules/

&& ln -sf /dev/stderr /var/log/nginx/error.log
# Copy default html files to a writable location
RUN mkdir -p /etc/nginx/html \
&& cp /usr/share/nginx/html/* /etc/nginx/html/
Expand All @@ -70,7 +68,7 @@ RUN chown -R 101:1001 /etc/nginx /var/cache/nginx

# Copy configuration files and scripts
COPY build/entrypoint.sh /agent/entrypoint.sh
COPY ${NJS_DIR}/ /usr/lib/nginx/modules/njs/
COPY ${NJS_DIR}/ /usr/lib64/nginx/modules/njs/
COPY ${NGINX_CONF_DIR}/nginx.conf /etc/nginx/nginx.conf
COPY ${NGINX_CONF_DIR}/grpc-error-locations.conf /etc/nginx/grpc-error-locations.conf
COPY ${NGINX_CONF_DIR}/grpc-error-pages.conf /etc/nginx/grpc-error-pages.conf
Expand Down
2 changes: 1 addition & 1 deletion examples/http-request-header-filter/headers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ data:
pid /var/run/nginx.pid;
load_module /usr/lib/nginx/modules/ngx_http_js_module.so;
load_module modules/ngx_http_js_module.so;
events {}
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/nginx/conf/nginx-plus.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load_module /usr/lib/nginx/modules/ngx_http_js_module.so;
load_module modules/ngx_http_js_module.so;
include /etc/nginx/main-includes/*.conf;

worker_processes auto;
Expand All @@ -12,7 +12,7 @@ events {
http {
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/mime.types;
js_import /usr/lib/nginx/modules/njs/httpmatches.js;
js_import modules/njs/httpmatches.js;

default_type application/octet-stream;

Expand Down
4 changes: 2 additions & 2 deletions internal/controller/nginx/conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load_module /usr/lib/nginx/modules/ngx_http_js_module.so;
load_module modules/ngx_http_js_module.so;
include /etc/nginx/main-includes/*.conf;

worker_processes auto;
Expand All @@ -12,7 +12,7 @@ events {
http {
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/mime.types;
js_import /usr/lib/nginx/modules/njs/httpmatches.js;
js_import modules/njs/httpmatches.js;

default_type application/octet-stream;

Expand Down
Loading