Skip to content

Commit 37ca1a9

Browse files
authored
Fixes for dependabot and automated builds (#642)
1 parent cc980c9 commit 37ca1a9

File tree

6 files changed

+36
-41
lines changed

6 files changed

+36
-41
lines changed

.github/workflows/docker.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Output Variables
3838
id: var
3939
run: |
40-
echo "nginx_version=$(grep -m1 'ARG BUILD_NGINX_VERSION=' <Dockerfile | awk -F'[= ]' '{print $3}')" >> $GITHUB_OUTPUT
40+
echo "nginx_version=$(grep -m1 'FROM nginx:' <Dockerfile | awk -F'[: ]' '{print $3}')" >> $GITHUB_OUTPUT
4141
4242
- name: Nginx version
4343
run: echo "${{ steps.var.outputs.nginx_version }}"

.github/workflows/system-testing.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@ jobs:
2929
- name: Get vars
3030
id: vars
3131
run: |
32-
# replace with version from Dockerfile when fixed
33-
echo "NGINX_VERSION=1.27.0" >> $GITHUB_OUTPUT
32+
echo "nginx_version=$(grep -m1 'FROM nginx:' <Dockerfile | awk -F'[: ]' '{print $3}')" >> $GITHUB_OUTPUT
3433
3534
- name: Setup Python
3635
uses: actions/setup-python@v5
3736
with:
38-
python-version-file: '.python-version'
39-
cache: 'pip'
37+
python-version-file: ".python-version"
38+
cache: "pip"
4039

4140
- name: Install Dependencies
4241
run: pip install -r test/requirements.ci.txt
@@ -54,7 +53,7 @@ jobs:
5453
cache-from: type=gha,scope=system-nginx
5554
cache-to: type=gha,scope=system-nginx,mode=max
5655
build-args: |
57-
NGINX_VERSION=${{ steps.vars.outputs.NGINX_VERSION }}
56+
NGINX_VERSION=${{ steps.vars.outputs.nginx_version }}
5857
5958
- name: Build backend
6059
uses: docker/build-push-action@v6

.github/workflows/update-docker-images.yml

+8-12
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,21 @@ name: Update Docker Images
22

33
on:
44
schedule:
5-
- cron: '0 1 * * *'
5+
- cron: "0 1 * * *"
66
workflow_dispatch:
77

88
defaults:
99
run:
1010
shell: bash
1111

1212
jobs:
13-
1413
variables:
1514
name: Get version of base image
1615
runs-on: ubuntu-20.04
1716
outputs:
1817
versions: ${{ steps.version.outputs.matrix }}
1918
git_tag: ${{ steps.tag.outputs.git_tag }}
2019
docker_platforms: ${{ steps.vars.outputs.docker_platforms }}
21-
sha_long: ${{ steps.vars.outputs.sha_long }}
2220
steps:
2321
- name: Checkout Repository
2422
uses: actions/checkout@v4
@@ -28,7 +26,7 @@ jobs:
2826
id: tag
2927
run: |
3028
tag=$(git tag --sort=-version:refname | head -n1)
31-
echo "::set-output name=git_tag::${tag//v}"
29+
echo "git_tag=${tag//v}" >> $GITHUB_OUTPUT
3230
- name: Checkout Repository at ${{ steps.tag.outputs.git_tag }}
3331
uses: actions/checkout@v4
3432
with:
@@ -38,12 +36,11 @@ jobs:
3836
run: |
3937
nginx_alpine=library/nginx:$(grep -m1 "FROM.*nginx.*alpine" <Dockerfile | awk -F"[ :]" '{print $3}')
4038
nginx=library/$(grep -m1 "FROM nginx:" < Dockerfile | awk -F" " '{print $2}')
41-
echo "::set-output name=matrix::[{\"version\": \"${nginx}\", \"distro\": \"debian\"}, {\"version\": \"${nginx_alpine}\", \"distro\": \"alpine\"}]"
39+
echo "matrix=[{\"version\": \"${nginx}\", \"distro\": \"debian\"}, {\"version\": \"${nginx_alpine}\", \"distro\": \"alpine\"}]" >> $GITHUB_OUTPUT
4240
- name: Set other variables
4341
id: vars
4442
run: |
45-
echo "::set-output name=docker_platforms::$(grep "PLATFORMS:" .github/workflows/docker.yml | awk -F" " '{print $2}')"
46-
echo "::set-output name=sha_long::$(git rev-parse HEAD)"
43+
echo "docker_platforms=$(grep "PLATFORMS:" .github/workflows/docker.yml | awk -F" " '{print $2}')" >> $GITHUB_OUTPUT
4744
4845
check:
4946
name: Check if updates are needed
@@ -60,7 +57,7 @@ jobs:
6057
id: dist
6158
run: |
6259
if [ ${{ matrix.base_image.distro }} == "debian" ]; then dist=""; else dist="-${{ matrix.base_image.distro }}"; fi
63-
echo "::set-output name=tag::${{ needs.variables.outputs.git_tag }}${dist}"
60+
echo "tag=${{ needs.variables.outputs.git_tag }}${dist}" >> $GITHUB_OUTPUT
6461
- name: Check if update available ${{ matrix.base_image.version }}
6562
id: update
6663
uses: lucacome/docker-image-update-checker@v1
@@ -69,7 +66,7 @@ jobs:
6966
image: opentracing/nginx-opentracing:${{ steps.dist.outputs.tag }}
7067
- id: var
7168
run: |
72-
echo "::set-output name=${{ matrix.base_image.distro }}::${{ steps.update.outputs.needs-updating }}"
69+
echo "${{ matrix.base_image.distro }}=${{ steps.update.outputs.needs-updating }}" >> $GITHUB_OUTPUT
7370
7471
build-docker:
7572
if: ${{ needs.check.outputs.needs-updating-debian == 'true' || needs.check.outputs.needs-updating-alpine == 'true' }}
@@ -93,7 +90,7 @@ jobs:
9390
- name: Output Variables
9491
id: var
9592
run: |
96-
echo "::set-output name=nginx_version::$(grep -m1 'FROM nginx:' <Dockerfile | awk -F'[: ]' '{print $3}')"
93+
echo "nginx_version=$(grep -m1 'FROM nginx:' <Dockerfile | awk -F'[: ]' '{print $3}')" >> $GITHUB_OUTPUT
9794
if: ${{ matrix.needs-updating == 'true' }}
9895

9996
- name: Setup QEMU
@@ -123,6 +120,7 @@ jobs:
123120
id: meta
124121
uses: docker/metadata-action@v5
125122
with:
123+
context: git
126124
images: |
127125
opentracing/nginx-opentracing
128126
ghcr.io/opentracing-contrib/nginx-opentracing
@@ -132,8 +130,6 @@ jobs:
132130
tags: |
133131
type=raw,value=${{ needs.variables.outputs.git_tag }}
134132
type=raw,value=nginx-${{ steps.var.outputs.nginx_version }}
135-
labels: |
136-
org.opencontainers.image.revision=${{ needs.variables.outputs.sha_long }}
137133
if: ${{ matrix.needs-updating == 'true' }}
138134

139135
- name: Build and push

Dockerfile

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# syntax=docker/dockerfile:1.3
1+
# syntax=docker/dockerfile:1.8
22
ARG BUILD_OS=debian
3-
ARG BUILD_NGINX_VERSION=1.27.0
43
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.4.0 AS xx
54

65
### Build base image for debian
7-
FROM --platform=$BUILDPLATFORM debian:bullseye as build-base-debian
6+
FROM --platform=$BUILDPLATFORM debian:11 AS build-base-debian
87

98
RUN apt-get update \
109
&& apt-get install --no-install-recommends --no-install-suggests -y \
@@ -30,7 +29,7 @@ RUN xx-apt install -y xx-cxx-essentials zlib1g-dev libcurl4-openssl-dev libc-are
3029

3130

3231
### Build base image for alpine
33-
FROM --platform=$BUILDPLATFORM alpine:3.20 as build-base-alpine
32+
FROM --platform=$BUILDPLATFORM alpine:3.20 AS build-base-alpine
3433

3534
RUN apk add --no-cache \
3635
alpine-sdk \
@@ -52,9 +51,9 @@ RUN xx-apk add --no-cache xx-cxx-essentials openssl-dev zlib-dev zlib libgcc cur
5251

5352

5453
### Build image
55-
FROM build-base-${BUILD_OS} as build-base
54+
FROM build-base-${BUILD_OS} AS build-base
5655

57-
ENV CMAKE_VERSION 3.22.2
56+
ENV CMAKE_VERSION=3.29.6
5857
RUN wget -q -O cmake-linux.sh "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-$(arch).sh" \
5958
&& sh cmake-linux.sh -- --skip-license --prefix=/usr \
6059
&& rm cmake-linux.sh
@@ -64,7 +63,7 @@ ENV XX_CC_PREFER_STATIC_LINKER=1
6463

6564

6665
## Build gRPC
67-
FROM build-base as grpc
66+
FROM build-base AS grpc
6867
ARG GRPC_VERSION=v1.40.x
6968
ARG TARGETPLATFORM
7069

@@ -91,7 +90,7 @@ RUN xx-info env && git clone --depth 1 -b $GRPC_VERSION https://github.com/grpc/
9190

9291

9392
### Build opentracing-cpp
94-
FROM build-base as opentracing-cpp
93+
FROM build-base AS opentracing-cpp
9594
ARG OPENTRACING_CPP_VERSION=v1.6.0
9695
ARG TARGETPLATFORM
9796

@@ -112,7 +111,7 @@ RUN xx-info env && git clone --depth 1 -b $OPENTRACING_CPP_VERSION https://githu
112111

113112

114113
### Build zipkin-cpp-opentracing
115-
FROM opentracing-cpp as zipkin-cpp-opentracing
114+
FROM opentracing-cpp AS zipkin-cpp-opentracing
116115
ARG ZIPKIN_CPP_VERSION=master
117116
ARG TARGETPLATFORM
118117

@@ -133,7 +132,7 @@ RUN [ "$(xx-info vendor)" = "alpine" ] && export QEMU_LD_PREFIX=/$(xx-info); \
133132

134133

135134
### Build Jaeger cpp-client
136-
FROM opentracing-cpp as jaeger-cpp-client
135+
FROM opentracing-cpp AS jaeger-cpp-client
137136
ARG JAEGER_CPP_VERSION=v0.9.0
138137
ARG YAML_CPP_VERSION=yaml-cpp-0.7.0
139138
ARG TARGETPLATFORM
@@ -184,7 +183,7 @@ RUN git clone --depth 1 -b $JAEGER_CPP_VERSION https://github.com/jaegertracing/
184183

185184

186185
### Build dd-opentracing-cpp
187-
FROM opentracing-cpp as dd-opentracing-cpp
186+
FROM opentracing-cpp AS dd-opentracing-cpp
188187
ARG DATADOG_VERSION=master
189188
ARG TARGETPLATFORM
190189

@@ -202,23 +201,24 @@ RUN xx-info env && git clone --depth 1 -b $DATADOG_VERSION https://github.com/Da
202201

203202

204203
### Base build image for debian
205-
FROM nginx:${BUILD_NGINX_VERSION}-bookworm as build-nginx-debian
204+
FROM nginx:1.27.0 AS build-nginx-debian
206205

207-
RUN echo "deb-src [signed-by=/etc/apt/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/mainline/debian/ bookworm nginx" >> /etc/apt/sources.list.d/nginx.list \
206+
RUN DEBIAN_VERSION=$(awk -F '=' '/^VERSION_CODENAME=/ {print $2}' /etc/os-release) \
207+
&& echo "deb-src [signed-by=/etc/apt/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/mainline/debian/ ${DEBIAN_VERSION} nginx" >> /etc/apt/sources.list.d/nginx.list \
208208
&& apt-get update \
209209
&& apt-get build-dep -y nginx
210210

211211

212212
### Base build image for alpine
213-
FROM nginx:${BUILD_NGINX_VERSION}-alpine AS build-nginx-alpine
213+
FROM nginx:1.27.0-alpine AS build-nginx-alpine
214214
RUN apk add --no-cache \
215215
build-base \
216216
pcre2-dev \
217217
zlib-dev
218218

219219

220220
### Build nginx-opentracing modules
221-
FROM build-nginx-${BUILD_OS} as build-nginx
221+
FROM build-nginx-${BUILD_OS} AS build-nginx
222222

223223
COPY --from=jaeger-cpp-client /hunter /hunter
224224
COPY . /src
@@ -237,16 +237,16 @@ RUN curl -fsSL -O https://github.com/nginx/nginx/archive/release-${NGINX_VERSION
237237

238238

239239
### Base image for alpine
240-
FROM nginx:${BUILD_NGINX_VERSION}-alpine as nginx-alpine
240+
FROM nginx:1.27.0-alpine AS nginx-alpine
241241
RUN apk add --no-cache libstdc++
242242

243243

244244
### Base image for debian
245-
FROM nginx:${BUILD_NGINX_VERSION}-bookworm as nginx-debian
245+
FROM nginx:1.27.0 AS nginx-debian
246246

247247

248248
### Build final image
249-
FROM nginx-${BUILD_OS} as final
249+
FROM nginx-${BUILD_OS} AS final
250250

251251
COPY --from=build-nginx /usr/lib/nginx/modules/ /usr/lib/nginx/modules/
252252
COPY --from=dd-opentracing-cpp /usr/local/lib/ /usr/local/lib/

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
NGINX_VERSION=1.27.0
1+
NGINX_VERSION=$(shell grep -m1 'FROM nginx:' <Dockerfile | awk -F'[: ]' '{print $$3}')
22

33
.PHONY: docker-image
44
docker-image:

build/Dockerfile

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:stable as base
1+
FROM debian:12 AS base
22

33
RUN apt-get update && \
44
apt-get install --no-install-recommends --no-install-suggests -y \
@@ -21,7 +21,7 @@ ENV CXXFLAGS="-fPIC"
2121
ENV LDFLAGS="-fPIC"
2222

2323

24-
FROM base as opentracing
24+
FROM base AS opentracing
2525
ARG OPENTRACING_VERSION=v1.6.0
2626

2727
RUN <<"eot" bash -euo pipefail
@@ -38,7 +38,7 @@ RUN <<"eot" bash -euo pipefail
3838
eot
3939

4040

41-
FROM opentracing as binary
41+
FROM opentracing AS binary
4242
ARG NGINX_VERSION
4343

4444
COPY --link opentracing /opentracing
@@ -69,6 +69,6 @@ RUN /usr/bin/g++ -o ngx_http_opentracing_module.so \
6969
-shared
7070

7171

72-
FROM scratch as export
72+
FROM scratch AS export
7373
ARG NGINX_VERSION
7474
COPY --from=binary /nginx-release-${NGINX_VERSION}/ngx_http_opentracing_module.so /

0 commit comments

Comments
 (0)