Skip to content

Commit 2f6cd80

Browse files
committed
Split Docker files
1 parent c92fc04 commit 2f6cd80

File tree

6 files changed

+607
-96
lines changed

6 files changed

+607
-96
lines changed

.github/workflows/webserver.yml

Lines changed: 28 additions & 30 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,7 +215,7 @@ 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 \
218+
docker buildx build -t apache_centos7_arm64 -f docker/centos7-arm64/Dockerfile \
221219
--load . --platform linux/arm64 --build-arg BUILD_ARCH='arm64' \
222220
--build-arg CMAKE_ARCH='aarch64' --build-arg GOSU_ARCH='arm64' \
223221
--build-arg JDK_ARCH='aarch64' --build-arg NGINX_ARCH='aarch64'

instrumentation/otel-webserver-module/Dockerfile

Lines changed: 34 additions & 40 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.24.0"
3428

3529

@@ -60,14 +54,14 @@ RUN wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
6054

6155
# install devtoolset toolchain
6256
RUN curl https://www.getpagespeed.com/files/centos6-eol.repo --output /etc/yum.repos.d/CentOS-Base.repo \
63-
&& curl https://www.getpagespeed.com/files/centos6-epel-eol.repo --output /etc/yum.repos.d/epel.repo \
64-
&& yum -y install centos-release-scl \
65-
&& curl https://www.getpagespeed.com/files/centos6-scl-eol.repo --output /etc/yum.repos.d/CentOS-SCLo-scl.repo \
66-
&& curl https://www.getpagespeed.com/files/centos6-scl-rh-eol.repo --output /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo \
67-
&& yum install yum-utils -y \
68-
&& yum-config-manager --enable rhel-server-rhscl-7-rpms -y \
69-
&& yum install devtoolset-7 -y \
70-
&& yum clean all
57+
&& curl https://www.getpagespeed.com/files/centos6-epel-eol.repo --output /etc/yum.repos.d/epel.repo \
58+
&& yum -y install centos-release-scl \
59+
&& curl https://www.getpagespeed.com/files/centos6-scl-eol.repo --output /etc/yum.repos.d/CentOS-SCLo-scl.repo \
60+
&& curl https://www.getpagespeed.com/files/centos6-scl-rh-eol.repo --output /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo \
61+
&& yum install yum-utils -y \
62+
&& yum-config-manager --enable rhel-server-rhscl-7-rpms -y \
63+
&& yum install devtoolset-7 -y \
64+
&& yum clean all
7165
ENV PATH="/opt/rh/devtoolset-7/root/usr/bin:${PATH}"
7266

7367
# install python
@@ -79,36 +73,36 @@ 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
8882

8983
# install git required for grpc
9084
RUN yum install git -y \
91-
&& yum clean all
85+
&& 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} \
97-
&& cp -rf * /usr/local/ \
98-
&& cd .. && rm -rf cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz
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 \
91+
&& cp -rf * /usr/local/ \
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 \
102-
&& cd grpc \
103-
&& git checkout tags/v${GRPC_VERSION} -b v${GRPC_VERSION} \
104-
&& git submodule update --init \
105-
&& sed -i "s/target_link_libraries(bssl ssl crypto)/target_link_libraries(bssl ssl crypto rt)/g" third_party/boringssl-with-bazel/CMakeLists.txt \
106-
&& mkdir -p cmake/build \
107-
&& cd cmake/build \
108-
&& cmake ../.. -DgRPC_INSTALL=ON -DCMAKE_BUILD_TYPE=Release -DgRPC_ABSL_PROVIDER=module -DgRPC_CARES_PROVIDER=module -DgRPC_PROTOBUF_PROVIDER=module -DgRPC_RE2_PROVIDER=module -DgRPC_SSL_PROVIDER=module -DgRPC_ZLIB_PROVIDER=module \
109-
&& make \
110-
&& make install \
111-
&& cd ../../..
96+
&& cd grpc \
97+
&& git checkout tags/v${GRPC_VERSION} -b v${GRPC_VERSION} \
98+
&& git submodule update --init \
99+
&& sed -i "s/target_link_libraries(bssl ssl crypto)/target_link_libraries(bssl ssl crypto rt)/g" third_party/boringssl-with-bazel/CMakeLists.txt \
100+
&& mkdir -p cmake/build \
101+
&& cd cmake/build \
102+
&& cmake ../.. -DgRPC_INSTALL=ON -DCMAKE_BUILD_TYPE=Release -DgRPC_ABSL_PROVIDER=module -DgRPC_CARES_PROVIDER=module -DgRPC_PROTOBUF_PROVIDER=module -DgRPC_RE2_PROVIDER=module -DgRPC_SSL_PROVIDER=module -DgRPC_ZLIB_PROVIDER=module \
103+
&& make \
104+
&& make install \
105+
&& cd ../../..
112106

113107
# Create dependencies folder to store all dependencies.
114108
RUN mkdir -p dependencies
@@ -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

0 commit comments

Comments
 (0)