Skip to content

Commit d9eb65e

Browse files
committed
Split Docker files
Build arguments are no longer needed
1 parent f7e0a28 commit d9eb65e

File tree

7 files changed

+649
-95
lines changed

7 files changed

+649
-95
lines changed

.github/workflows/webserver.yml

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ on:
1313
- '.github/workflows/webserver.yml'
1414

1515
jobs:
16-
webserver-build-test-ubuntu-x64:
17-
name: webserver-ubuntu-build-x64
16+
webserver-build-test-ubuntu:
17+
name: webserver-ubuntu-build
1818
runs-on: ubuntu-20.04
1919
steps:
2020
- name: checkout otel webserver
@@ -24,7 +24,6 @@ jobs:
2424
uses: docker/setup-buildx-action@master
2525
with:
2626
install: true
27-
platforms: linux/amd64
2827
- name: cache docker layers
2928
uses: actions/cache@v3
3029
with:
@@ -35,18 +34,18 @@ jobs:
3534
- name: setup docker image
3635
run: |
3736
cd instrumentation/otel-webserver-module
38-
docker buildx build -t apache_ubuntu_amd64 -f docker/ubuntu20.04/Dockerfile \
39-
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu_amd64 \
40-
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu_amd64-new \
37+
docker buildx build -t apache_ubuntu -f docker/ubuntu20.04/Dockerfile \
38+
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu \
39+
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu-new \
4140
--load .
4241
- name: build
4342
run: |
44-
docker run -idt --name apache_ubuntu_container_amd64 apache_ubuntu_amd64 /bin/bash
43+
docker run -idt --name apache_ubuntu_container apache_ubuntu /bin/bash
4544
cd instrumentation/otel-webserver-module
46-
docker exec apache_ubuntu_container_amd64 bash -c \
45+
docker exec apache_ubuntu_container bash -c \
4746
'cd /otel-webserver-module; rm -rf *;'
48-
docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container_amd64):/otel-webserver-module/
49-
docker exec apache_ubuntu_container_amd64 bash -c \
47+
docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container):/otel-webserver-module/
48+
docker exec apache_ubuntu_container bash -c \
5049
'cd /otel-webserver-module; rm -rf build; \
5150
cp -r /dependencies /otel-webserver-module/; \
5251
cp -r /build-dependencies /otel-webserver-module/; \
@@ -55,8 +54,8 @@ jobs:
5554
5655
- name: update cache
5756
run: |
58-
rm -rf /tmp/buildx-cache/apache_ubuntu_amd64
59-
mv /tmp/buildx-cache/apache_ubuntu_amd64-new /tmp/buildx-cache/apache_ubuntu_amd64
57+
rm -rf /tmp/buildx-cache/apache_ubuntu
58+
mv /tmp/buildx-cache/apache_ubuntu-new /tmp/buildx-cache/apache_ubuntu
6059
6160
webserver-build-test-ubuntu-arm64:
6261
name: webserver-ubuntu-build-arm64
@@ -82,7 +81,7 @@ jobs:
8281
- name: setup docker image
8382
run: |
8483
cd instrumentation/otel-webserver-module
85-
docker buildx build -t apache_ubuntu_arm64 -f docker/ubuntu20.04/Dockerfile \
84+
docker buildx build -t apache_ubuntu_arm64 -f docker/ubuntu20.04-arm64/Dockerfile \
8685
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu_arm64 \
8786
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu_arm64-new \
8887
--load . --platform linux/arm64
@@ -128,8 +127,8 @@ jobs:
128127
# sleep 30
129128
# ./gradlew :test:integration:integrationTests -i
130129

131-
webserver-build-test-centos7-x64:
132-
name: webserver-centos7-build-x64
130+
webserver-build-test-centos7:
131+
name: webserver-centos7-build
133132
runs-on: ubuntu-20.04
134133
steps:
135134
- name: checkout otel webserver
@@ -139,7 +138,6 @@ jobs:
139138
uses: docker/setup-buildx-action@master
140139
with:
141140
install: true
142-
platforms: linux/amd64
143141
# - name: cache docker layers
144142
# uses: actions/cache@v3
145143
# with:
@@ -150,43 +148,43 @@ jobs:
150148
- name: setup docker image
151149
run: |
152150
cd instrumentation/otel-webserver-module
153-
docker buildx build -t apache_centos7_amd64 -f docker/centos7/Dockerfile \
151+
docker buildx build -t apache_centos7 -f docker/centos7/Dockerfile \
154152
--load .
155153
- name: build
156154
run: |
157-
docker run -idt --name apache_centos7_container_amd64 apache_centos7_amd64 /bin/bash
155+
docker run -idt --name apache_centos7_container apache_centos7 /bin/bash
158156
cd instrumentation/otel-webserver-module
159-
docker exec apache_centos7_container_amd64 bash -c \
157+
docker exec apache_centos7_container bash -c \
160158
'cd /otel-webserver-module; rm -rf *;'
161-
docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container_amd64):/otel-webserver-module/
162-
docker exec apache_centos7_container_amd64 bash -c \
159+
docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container):/otel-webserver-module/
160+
docker exec apache_centos7_container bash -c \
163161
'cd /otel-webserver-module; rm -rf build; \
164162
cp -r /dependencies /otel-webserver-module/; \
165163
cp -r /build-dependencies /otel-webserver-module/; \
166164
./gradlew assembleWebServerModule'
167165
- name: unit test
168166
run: |
169-
docker exec apache_centos7_container_amd64 bash -c \
167+
docker exec apache_centos7_container bash -c \
170168
'cd /otel-webserver-module; ./gradlew runUnitTest'
171169
# - name: update cache
172170
# run: |
173-
# rm -rf /tmp/buildx-cache/apache_centos7_amd64
174-
# mv /tmp/buildx-cache/apache_centos7_amd64-new /tmp/buildx-cache/apache_centos7_amd64
171+
# rm -rf /tmp/buildx-cache/apache_centos7
172+
# mv /tmp/buildx-cache/apache_centos7-new /tmp/buildx-cache/apache_centos7
175173
- name: copy artifacts
176174
id: artifacts
177175
run: |
178176
cd instrumentation/otel-webserver-module
179-
mkdir -p /tmp/apache_centos7_amd64/
180-
docker cp apache_centos7_container_amd64:/otel-webserver-module/build/opentelemetry-webserver-sdk-x64-linux.tgz \
181-
/tmp/apache_centos7_amd64/
177+
mkdir -p /tmp/apache_centos7/
178+
docker cp apache_centos7_container:/otel-webserver-module/build/opentelemetry-webserver-sdk-x64-linux.tgz \
179+
/tmp/apache_centos7/
182180
- name: upload artifacts
183181
uses: actions/upload-artifact@v3
184182
with:
185183
name: opentelemetry-webserver-sdk-x64-linux.tgz
186-
path: /tmp/apache_centos7_amd64/opentelemetry-webserver-sdk-x64-linux.tgz
184+
path: /tmp/apache_centos7/opentelemetry-webserver-sdk-x64-linux.tgz
187185
- name: run integrationtest
188186
run: |
189-
docker rm -f apache_centos7_container_amd64
187+
docker rm -f apache_centos7_container
190188
cd instrumentation/otel-webserver-module
191189
docker compose --profile centos7 up -d
192190
docker ps -a
@@ -217,10 +215,8 @@ jobs:
217215
- name: setup docker image
218216
run: |
219217
cd instrumentation/otel-webserver-module
220-
docker buildx build -t apache_centos7_arm64 -f docker/centos7/Dockerfile \
221-
--load . --platform linux/arm64 --build-arg BUILD_ARCH='arm64' \
222-
--build-arg CMAKE_ARCH='aarch64' --build-arg GOSU_ARCH='arm64' \
223-
--build-arg JDK_ARCH='aarch64' --build-arg NGINX_ARCH='aarch64'
218+
docker buildx build -t apache_centos7_arm64 -f docker/centos7-arm64/Dockerfile \
219+
--load . --platform linux/arm64
224220
- name: build
225221
run: |
226222
docker run -idt --platform linux/arm64 --name apache_centos7_container_arm64 apache_centos7_arm64 /bin/bash

instrumentation/otel-webserver-module/Dockerfile

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
FROM centos:6.9
22

33
ARG BUILD_NUMBER
4-
ARG BUILD_ARCH='x64'
54

6-
LABEL NAME=apm/build-image-webserver-agent-centos6-${BUILD_ARCH} VERSION=$BUILD_NUMBER
5+
LABEL NAME=apm/build-image-webserver-agent-centos6-x64 VERSION=$BUILD_NUMBER
76

8-
ARG GOSU_ARCH='amd64'
9-
ENV GOSU_ARCH=${GOSU_ARCH}
10-
ARG JDK_ARCH='x64'
11-
ENV JDK_ARCH=${JDK_ARCH}
7+
ENV GOSU_ARCH amd64
8+
ENV JDK_ARCH x64
129

13-
ARG PYTHON_VERSION="2.7.18"
14-
ARG CMAKE_ARCH='x86_64'
10+
ARG PYTHON_VERSION="2.7.8"
1511
ARG CMAKE_VERSION="3.20"
1612
ARG CMAKE_0VERSION="3.20.0"
1713
ARG GRPC_VERSION="1.36.4"
@@ -22,14 +18,12 @@ ARG APR_VERSION="1.7.0"
2218
ARG EXPAT_VERSION="2.3.0"
2319
ARG EXPAT_RVERSION="R_2_3_0"
2420
ARG APRUTIL_VERSION="1.6.1"
25-
ARG AUTOCONF_BUILD_TYPE='x86_64-unknown-linux-gnu'
2621
ARG AUTOCONF_VERSION="2.68"
2722
ARG LIBTOOL_VERSION="2.4.6"
2823
ARG LOG4CXX_VERSION="0.11.0"
2924
ARG GTEST_VERSION="1.10.0"
3025
ARG AUTOMAKE_VERSION="1.16.3"
3126
ARG PCRE_VERSION="8.44"
32-
ARG NGINX_ARCH='x86_64'
3327
ARG NGINX_VERSION="1.26.0"
3428

3529

@@ -79,9 +73,9 @@ RUN wget http://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERS
7973
&& rm -rf Python-${PYTHON_VERSION}.tar.xz && rm -rf Python-${PYTHON_VERSION}.tar
8074

8175
# install gosu for easy step-down from root (from https://github.com/tianon/gosu/blob/master/INSTALL.md#from-centos)
82-
ENV GOSU_VERSION=1.11
76+
ENV GOSU_VERSION=1.10
8377

84-
RUN curl -o /usr/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${GOSU_ARCH}" \
78+
RUN curl -o /usr/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" \
8579
&& chmod +x /usr/bin/gosu \
8680
# Verify that the binary works
8781
&& gosu nobody true
@@ -91,11 +85,11 @@ RUN yum install git -y \
9185
&& yum clean all
9286

9387
# install cmake
94-
RUN wget https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz \
95-
&& tar -xvf cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz \
96-
&& cd cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH} \
88+
RUN wget https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz \
89+
&& tar -xvf cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz \
90+
&& cd cmake-${CMAKE_0VERSION}-linux-x86_64 \
9791
&& cp -rf * /usr/local/ \
98-
&& cd .. && rm -rf cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz
92+
&& cd .. && rm -rf cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz
9993

10094
# install grpc. If planning to upgrade, make sure sed command works
10195
RUN git clone https://github.com/grpc/grpc \
@@ -158,7 +152,7 @@ RUN yum install m4 -y
158152
RUN wget --no-check-certificate https://ftp.gnu.org/gnu/autoconf/autoconf-${AUTOCONF_VERSION}.tar.gz \
159153
&& tar xzf autoconf-${AUTOCONF_VERSION}.tar.gz \
160154
&& cd autoconf-${AUTOCONF_VERSION} \
161-
&& ./configure --prefix=/usr/ --build=${AUTOCONF_BUILD_TYPE} && make -j && make install && autoconf -V \
155+
&& ./configure --prefix=/usr/ && make -j && make install && autoconf -V \
162156
&& cd .. && rm -rf autoconf-${AUTOCONF_VERSION}.tar.gz
163157

164158
# install automake
@@ -263,13 +257,13 @@ RUN cp -r /dependencies /otel-webserver-module/ \
263257

264258
RUN echo '[nginx]' >> /etc/yum.repos.d/nginx.repo \
265259
&& echo 'name=nginx repo' >> /etc/yum.repos.d/nginx.repo \
266-
&& echo "baseurl=https://nginx.org/packages/centos/6/${NGINX_ARCH}" >> /etc/yum.repos.d/nginx.repo \
260+
&& echo 'baseurl=https://nginx.org/packages/centos/6/x86_64' >> /etc/yum.repos.d/nginx.repo \
267261
&& echo 'gpgcheck=0' >> /etc/yum.repos.d/nginx.repo \
268262
&& echo 'enabled=1' >> /etc/yum.repos.d/nginx.repo \
269263
&& yum install nginx -y
270264

271265
RUN cd /otel-webserver-module/build \
272-
&& tar -xf opentelemetry-webserver-sdk-${BUILD_ARCH}-linux.tgz \
266+
&& tar -xf opentelemetry-webserver-sdk-x64-linux.tgz \
273267
&& mv -f opentelemetry-webserver-sdk /opt/ \
274268
&& cd ../ \
275269
&& cp opentelemetry_module.conf /etc/httpd/conf/ \
@@ -284,7 +278,7 @@ RUN cp /otel-webserver-module/conf/nginx/opentelemetry_module.conf /opt/ \
284278
&& cd /
285279

286280
# Remove unwanted files
287-
RUN rm -rf grpc && rm -rf autoconf-${AUTOCONF_VERSION} && rm -rf automake-${AUTOMAKE_VERSION} && rm -rf cmake-${CMAKE_VERSION}-linux-${CMAKE_ARCH} \
281+
RUN rm -rf grpc && rm -rf autoconf-${AUTOCONF_VERSION} && rm -rf automake-${AUTOMAKE_VERSION} && rm -rf cmake-${CMAKE_VERSION}-linux-x86_64 \
288282
&& rm -rf libtool-${LIBTOOL_VERSION} && rm -rf Python-${PYTHON_VERSION} \
289283
&& rm -f apr-${APR_VERSION}.tar.gz && rm -f apr-util-${APRUTIL_VERSION}.tar.gz \
290284
&& rm -f httpd-2.2.31.tar.gz && rm -f httpd-2.4.23.tar.gz

instrumentation/otel-webserver-module/docker-compose.yml

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ services:
77
build:
88
context: .
99
dockerfile: Dockerfile
10-
platforms:
11-
- "linux/amd64"
12-
- "linux/arm64"
1310
image: apache_centos
1411
profiles:
1512
- default
@@ -22,9 +19,6 @@ services:
2219
build:
2320
context: .
2421
dockerfile: docker/centos7/Dockerfile
25-
platforms:
26-
- "linux/amd64"
27-
- "linux/arm64"
2822
image: apache_centos7
2923
hostname: webserver
3024
container_name: webserver_centos7
@@ -35,13 +29,26 @@ services:
3529
- "9004:80"
3630
depends_on:
3731
- otel-collector
38-
webserver_ubuntu:
32+
webserver_centos7-arm64:
3933
build:
4034
context: .
41-
dockerfile: docker/ubuntu20.04/Dockerfile
35+
dockerfile: docker/centos7-arm64/Dockerfile
4236
platforms:
43-
- "linux/amd64"
4437
- "linux/arm64"
38+
image: apache_centos7_arm64
39+
hostname: webserver
40+
container_name: webserver_centos7_arm64
41+
command: bash -c " httpd -k start && tail -f /dev/null "
42+
profiles:
43+
- centos7
44+
ports:
45+
- "9004:80"
46+
depends_on:
47+
- otel-collector
48+
webserver_ubuntu:
49+
build:
50+
context: .
51+
dockerfile: docker/ubuntu20.04/Dockerfile
4552
image: apache_ubuntu
4653
hostname: webserver
4754
container_name: webserver_ubuntu
@@ -52,13 +59,26 @@ services:
5259
- "9000:80"
5360
depends_on:
5461
- otel-collector
55-
nginx_centos:
62+
webserver_ubuntu-arm64:
5663
build:
5764
context: .
58-
dockerfile: Dockerfile
65+
dockerfile: docker/ubuntu20.04-arm64/Dockerfile
5966
platforms:
60-
- "linux/amd64"
6167
- "linux/arm64"
68+
image: apache_ubuntu_arm64
69+
hostname: webserver
70+
container_name: webserver_ubuntu_arm64
71+
command: bash -c "apache2ctl -k start && tail -f /dev/null "
72+
profiles:
73+
- ubuntu20.04
74+
ports:
75+
- "9000:80"
76+
depends_on:
77+
- otel-collector
78+
nginx_centos:
79+
build:
80+
context: .
81+
dockerfile: Dockerfile
6282
image: nginx_centos
6383
hostname: webserver
6484
container_name: nginx_centos
@@ -73,9 +93,6 @@ services:
7393
build:
7494
context: .
7595
dockerfile: docker/centos7/Dockerfile
76-
platforms:
77-
- "linux/amd64"
78-
- "linux/arm64"
7996
image: nginx_centos7
8097
hostname: webserver
8198
container_name: nginx_centos7
@@ -86,13 +103,26 @@ services:
86103
- "8012:80"
87104
depends_on:
88105
- otel-collector
89-
nginx_ubuntu:
106+
nginx_centos7-arm64:
90107
build:
91108
context: .
92-
dockerfile: docker/ubuntu20.04/Dockerfile
109+
dockerfile: docker/centos7/Dockerfile
93110
platforms:
94-
- "linux/amd64"
95111
- "linux/arm64"
112+
image: nginx_centos7_arm64
113+
hostname: webserver
114+
container_name: nginx_centos7_arm64
115+
command: bash -c "export LD_LIBRARY_PATH=/opt/opentelemetry-webserver-sdk/sdk_lib/lib && nginx && tail -f /dev/null"
116+
profiles:
117+
- centos7_nginx
118+
ports:
119+
- "8012:80"
120+
depends_on:
121+
- otel-collector
122+
nginx_ubuntu:
123+
build:
124+
context: .
125+
dockerfile: docker/ubuntu20.04/Dockerfile
96126
image: nginx_ubuntu
97127
hostname: webserver
98128
container_name: nginx_ubuntu
@@ -103,6 +133,22 @@ services:
103133
- "8016:80"
104134
depends_on:
105135
- otel-collector
136+
nginx_ubuntu-arm64:
137+
build:
138+
context: .
139+
dockerfile: docker/ubuntu20.04-arm64/Dockerfile
140+
platforms:
141+
- "linux/arm64"
142+
image: nginx_ubuntu_arm64
143+
hostname: webserver
144+
container_name: nginx_ubuntu_arm64
145+
command: bash -c "export LD_LIBRARY_PATH=/opt/opentelemetry-webserver-sdk/sdk_lib/lib && nginx && tail -f /dev/null"
146+
profiles:
147+
- ubuntu20.04_nginx
148+
ports:
149+
- "8016:80"
150+
depends_on:
151+
- otel-collector
106152

107153

108154
# Collector

0 commit comments

Comments
 (0)