diff --git a/.gitea/workflows/dockerfile_runner.yaml b/.gitea/workflows/dockerfile_runner.yaml index 89955d7..92ae9c2 100644 --- a/.gitea/workflows/dockerfile_runner.yaml +++ b/.gitea/workflows/dockerfile_runner.yaml @@ -37,6 +37,8 @@ jobs: tags: gitea.tryton.geeraert.eu/pi-ux-ce/geoip2-nginx:latest cache-from: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/geoip2-nginx:buildcache cache-to: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/geoip2-nginx:buildcache,mode=max + build-args: | + NGINX_VERSION=${{ vars.NGINX_VERSION }} - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/dockerfile b/dockerfile index 7ffcc06..070067a 100644 --- a/dockerfile +++ b/dockerfile @@ -1,15 +1,16 @@ +ARG NGINX_VERSION # Stage 1: Build the module -FROM nginx:1.26.3 AS builder +FROM nginx:$NGINX_VERSION AS builder # Install build tools and MaxMind library RUN apt-get update && \ apt-get install -y build-essential libmaxminddb-dev libpcre3-dev zlib1g-dev libssl-dev wget git && \ rm -rf /var/lib/apt/lists/* -#https://nginx.org/download/nginx-1.26.3.tar.gz +#https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz # Download NGINX source matching the container version -RUN wget http://nginx.org/download/nginx-1.26.3.tar.gz && \ - tar zxf nginx-1.26.3.tar.gz +RUN wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \ + tar zxf nginx-$NGINX_VERSION.tar.gz # Clone the specific GeoIP2 module project RUN git clone https://github.com/leev/ngx_http_geoip2_module.git @@ -20,13 +21,13 @@ RUN cd nginx-${NGINX_VERSION} && \ make modules # Stage 2: Final Image -FROM nginx:1.26.3 +FROM nginx:$NGINX_VERSION # Install only the runtime library RUN apt-get update && apt-get install -y libmaxminddb0 && rm -rf /var/lib/apt/lists/* # Copy the compiled .so file from the builder -COPY --from=builder /nginx-1.26.3/objs/ngx_http_geoip2_module.so /usr/lib/nginx/modules/ +COPY --from=builder /nginx-$NGINX_VERSION/objs/ngx_http_geoip2_module.so /usr/lib/nginx/modules/ # Copy your GeoIP database and NGINX config # Ensure these files are in the same folder as this Dockerfile