This commit is contained in:
@@ -37,6 +37,8 @@ jobs:
|
|||||||
tags: gitea.tryton.geeraert.eu/pi-ux-ce/geoip2-nginx:latest
|
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-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
|
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 }}."
|
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||||
|
|||||||
+7
-6
@@ -1,15 +1,16 @@
|
|||||||
|
ARG NGINX_VERSION
|
||||||
# Stage 1: Build the module
|
# Stage 1: Build the module
|
||||||
FROM nginx:1.26.3 AS builder
|
FROM nginx:$NGINX_VERSION AS builder
|
||||||
|
|
||||||
# Install build tools and MaxMind library
|
# Install build tools and MaxMind library
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y build-essential libmaxminddb-dev libpcre3-dev zlib1g-dev libssl-dev wget git && \
|
apt-get install -y build-essential libmaxminddb-dev libpcre3-dev zlib1g-dev libssl-dev wget git && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
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
|
# Download NGINX source matching the container version
|
||||||
RUN wget http://nginx.org/download/nginx-1.26.3.tar.gz && \
|
RUN wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \
|
||||||
tar zxf nginx-1.26.3.tar.gz
|
tar zxf nginx-$NGINX_VERSION.tar.gz
|
||||||
|
|
||||||
# Clone the specific GeoIP2 module project
|
# Clone the specific GeoIP2 module project
|
||||||
RUN git clone https://github.com/leev/ngx_http_geoip2_module.git
|
RUN git clone https://github.com/leev/ngx_http_geoip2_module.git
|
||||||
@@ -20,13 +21,13 @@ RUN cd nginx-${NGINX_VERSION} && \
|
|||||||
make modules
|
make modules
|
||||||
|
|
||||||
# Stage 2: Final Image
|
# Stage 2: Final Image
|
||||||
FROM nginx:1.26.3
|
FROM nginx:$NGINX_VERSION
|
||||||
|
|
||||||
# Install only the runtime library
|
# Install only the runtime library
|
||||||
RUN apt-get update && apt-get install -y libmaxminddb0 && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y libmaxminddb0 && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Copy the compiled .so file from the builder
|
# 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
|
# Copy your GeoIP database and NGINX config
|
||||||
# Ensure these files are in the same folder as this Dockerfile
|
# Ensure these files are in the same folder as this Dockerfile
|
||||||
|
|||||||
Reference in New Issue
Block a user