Skip to content

Commit

Permalink
Split Docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
Fydon committed May 2, 2024
1 parent c92fc04 commit 42626ad
Show file tree
Hide file tree
Showing 7 changed files with 640 additions and 92 deletions.
58 changes: 28 additions & 30 deletions .github/workflows/webserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ on:
- '.github/workflows/webserver.yml'

jobs:
webserver-build-test-ubuntu-x64:
name: webserver-ubuntu-build-x64
webserver-build-test-ubuntu:
name: webserver-ubuntu-build
runs-on: ubuntu-20.04
steps:
- name: checkout otel webserver
Expand All @@ -24,7 +24,6 @@ jobs:
uses: docker/setup-buildx-action@master
with:
install: true
platforms: linux/amd64
- name: cache docker layers
uses: actions/cache@v3
with:
Expand All @@ -35,18 +34,18 @@ jobs:
- name: setup docker image
run: |
cd instrumentation/otel-webserver-module
docker buildx build -t apache_ubuntu_amd64 -f docker/ubuntu20.04/Dockerfile \
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu_amd64 \
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu_amd64-new \
docker buildx build -t apache_ubuntu -f docker/ubuntu20.04/Dockerfile \
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu \
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu-new \
--load .
- name: build
run: |
docker run -idt --name apache_ubuntu_container_amd64 apache_ubuntu_amd64 /bin/bash
docker run -idt --name apache_ubuntu_container apache_ubuntu /bin/bash
cd instrumentation/otel-webserver-module
docker exec apache_ubuntu_container_amd64 bash -c \
docker exec apache_ubuntu_container bash -c \
'cd /otel-webserver-module; rm -rf *;'
docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container_amd64):/otel-webserver-module/
docker exec apache_ubuntu_container_amd64 bash -c \
docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container):/otel-webserver-module/
docker exec apache_ubuntu_container bash -c \
'cd /otel-webserver-module; rm -rf build; \
cp -r /dependencies /otel-webserver-module/; \
cp -r /build-dependencies /otel-webserver-module/; \
Expand All @@ -55,8 +54,8 @@ jobs:
- name: update cache
run: |
rm -rf /tmp/buildx-cache/apache_ubuntu_amd64
mv /tmp/buildx-cache/apache_ubuntu_amd64-new /tmp/buildx-cache/apache_ubuntu_amd64
rm -rf /tmp/buildx-cache/apache_ubuntu
mv /tmp/buildx-cache/apache_ubuntu-new /tmp/buildx-cache/apache_ubuntu
webserver-build-test-ubuntu-arm64:
name: webserver-ubuntu-build-arm64
Expand All @@ -82,7 +81,7 @@ jobs:
- name: setup docker image
run: |
cd instrumentation/otel-webserver-module
docker buildx build -t apache_ubuntu_arm64 -f docker/ubuntu20.04/Dockerfile \
docker buildx build -t apache_ubuntu_arm64 -f docker/ubuntu20.04-arm64/Dockerfile \
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu_arm64 \
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu_arm64-new \
--load . --platform linux/arm64
Expand Down Expand Up @@ -128,8 +127,8 @@ jobs:
# sleep 30
# ./gradlew :test:integration:integrationTests -i

webserver-build-test-centos7-x64:
name: webserver-centos7-build-x64
webserver-build-test-centos7:
name: webserver-centos7-build
runs-on: ubuntu-20.04
steps:
- name: checkout otel webserver
Expand All @@ -139,7 +138,6 @@ jobs:
uses: docker/setup-buildx-action@master
with:
install: true
platforms: linux/amd64
# - name: cache docker layers
# uses: actions/cache@v3
# with:
Expand All @@ -150,43 +148,43 @@ jobs:
- name: setup docker image
run: |
cd instrumentation/otel-webserver-module
docker buildx build -t apache_centos7_amd64 -f docker/centos7/Dockerfile \
docker buildx build -t apache_centos7 -f docker/centos7/Dockerfile \
--load .
- name: build
run: |
docker run -idt --name apache_centos7_container_amd64 apache_centos7_amd64 /bin/bash
docker run -idt --name apache_centos7_container apache_centos7 /bin/bash
cd instrumentation/otel-webserver-module
docker exec apache_centos7_container_amd64 bash -c \
docker exec apache_centos7_container bash -c \
'cd /otel-webserver-module; rm -rf *;'
docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container_amd64):/otel-webserver-module/
docker exec apache_centos7_container_amd64 bash -c \
docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container):/otel-webserver-module/
docker exec apache_centos7_container bash -c \
'cd /otel-webserver-module; rm -rf build; \
cp -r /dependencies /otel-webserver-module/; \
cp -r /build-dependencies /otel-webserver-module/; \
./gradlew assembleWebServerModule'
- name: unit test
run: |
docker exec apache_centos7_container_amd64 bash -c \
docker exec apache_centos7_container bash -c \
'cd /otel-webserver-module; ./gradlew runUnitTest'
# - name: update cache
# run: |
# rm -rf /tmp/buildx-cache/apache_centos7_amd64
# mv /tmp/buildx-cache/apache_centos7_amd64-new /tmp/buildx-cache/apache_centos7_amd64
# rm -rf /tmp/buildx-cache/apache_centos7
# mv /tmp/buildx-cache/apache_centos7-new /tmp/buildx-cache/apache_centos7
- name: copy artifacts
id: artifacts
run: |
cd instrumentation/otel-webserver-module
mkdir -p /tmp/apache_centos7_amd64/
docker cp apache_centos7_container_amd64:/otel-webserver-module/build/opentelemetry-webserver-sdk-x64-linux.tgz \
/tmp/apache_centos7_amd64/
mkdir -p /tmp/apache_centos7/
docker cp apache_centos7_container:/otel-webserver-module/build/opentelemetry-webserver-sdk-x64-linux.tgz \
/tmp/apache_centos7/
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: opentelemetry-webserver-sdk-x64-linux.tgz
path: /tmp/apache_centos7_amd64/opentelemetry-webserver-sdk-x64-linux.tgz
path: /tmp/apache_centos7/opentelemetry-webserver-sdk-x64-linux.tgz
- name: run integrationtest
run: |
docker rm -f apache_centos7_container_amd64
docker rm -f apache_centos7_container
cd instrumentation/otel-webserver-module
docker compose --profile centos7 up -d
docker ps -a
Expand Down Expand Up @@ -217,7 +215,7 @@ jobs:
- name: setup docker image
run: |
cd instrumentation/otel-webserver-module
docker buildx build -t apache_centos7_arm64 -f docker/centos7/Dockerfile \
docker buildx build -t apache_centos7_arm64 -f docker/centos7-arm64/Dockerfile \
--load . --platform linux/arm64 --build-arg BUILD_ARCH='arm64' \
--build-arg CMAKE_ARCH='aarch64' --build-arg GOSU_ARCH='arm64' \
--build-arg JDK_ARCH='aarch64' --build-arg NGINX_ARCH='aarch64'
Expand Down
34 changes: 14 additions & 20 deletions instrumentation/otel-webserver-module/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
FROM centos:6.9

ARG BUILD_NUMBER
ARG BUILD_ARCH='x64'

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

ARG GOSU_ARCH='amd64'
ENV GOSU_ARCH=${GOSU_ARCH}
ARG JDK_ARCH='x64'
ENV JDK_ARCH=${JDK_ARCH}
ENV GOSU_ARCH amd64
ENV JDK_ARCH x64

ARG PYTHON_VERSION="2.7.18"
ARG CMAKE_ARCH='x86_64'
ARG PYTHON_VERSION="2.7.8"
ARG CMAKE_VERSION="3.20"
ARG CMAKE_0VERSION="3.20.0"
ARG GRPC_VERSION="1.36.4"
Expand All @@ -22,14 +18,12 @@ ARG APR_VERSION="1.7.0"
ARG EXPAT_VERSION="2.3.0"
ARG EXPAT_RVERSION="R_2_3_0"
ARG APRUTIL_VERSION="1.6.1"
ARG AUTOCONF_BUILD_TYPE='x86_64-unknown-linux-gnu'
ARG AUTOCONF_VERSION="2.68"
ARG LIBTOOL_VERSION="2.4.6"
ARG LOG4CXX_VERSION="0.11.0"
ARG GTEST_VERSION="1.10.0"
ARG AUTOMAKE_VERSION="1.16.3"
ARG PCRE_VERSION="8.44"
ARG NGINX_ARCH='x86_64'
ARG NGINX_VERSION="1.24.0"


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

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

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

# install cmake
RUN wget https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz \
&& tar -xvf cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz \
&& cd cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH} \
RUN wget https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz \
&& tar -xvf cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz \
&& cd cmake-${CMAKE_0VERSION}-linux-x86_64 \
&& cp -rf * /usr/local/ \
&& cd .. && rm -rf cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz
&& cd .. && rm -rf cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz

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

# install automake
Expand Down Expand Up @@ -263,13 +257,13 @@ RUN cp -r /dependencies /otel-webserver-module/ \

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

RUN cd /otel-webserver-module/build \
&& tar -xf opentelemetry-webserver-sdk-${BUILD_ARCH}-linux.tgz \
&& tar -xf opentelemetry-webserver-sdk-x64-linux.tgz \
&& mv -f opentelemetry-webserver-sdk /opt/ \
&& cd ../ \
&& cp opentelemetry_module.conf /etc/httpd/conf/ \
Expand All @@ -284,7 +278,7 @@ RUN cp /otel-webserver-module/conf/nginx/opentelemetry_module.conf /opt/ \
&& cd /

# Remove unwanted files
RUN rm -rf grpc && rm -rf autoconf-${AUTOCONF_VERSION} && rm -rf automake-${AUTOMAKE_VERSION} && rm -rf cmake-${CMAKE_VERSION}-linux-${CMAKE_ARCH} \
RUN rm -rf grpc && rm -rf autoconf-${AUTOCONF_VERSION} && rm -rf automake-${AUTOMAKE_VERSION} && rm -rf cmake-${CMAKE_VERSION}-linux-x86_64 \
&& rm -rf libtool-${LIBTOOL_VERSION} && rm -rf Python-${PYTHON_VERSION} \
&& rm -f apr-${APR_VERSION}.tar.gz && rm -f apr-util-${APRUTIL_VERSION}.tar.gz \
&& rm -f httpd-2.2.31.tar.gz && rm -f httpd-2.4.23.tar.gz
Expand Down
74 changes: 56 additions & 18 deletions instrumentation/otel-webserver-module/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ services:
build:
context: .
dockerfile: Dockerfile
platforms:
- "linux/amd64"
- "linux/arm64"
image: apache_centos
profiles:
- default
Expand All @@ -22,9 +19,6 @@ services:
build:
context: .
dockerfile: docker/centos7/Dockerfile
platforms:
- "linux/amd64"
- "linux/arm64"
image: apache_centos7
hostname: webserver
container_name: webserver_centos7
Expand All @@ -35,13 +29,24 @@ services:
- "9004:80"
depends_on:
- otel-collector
webserver_centos7-arm64:
build:
context: .
dockerfile: docker/centos7-arm64/Dockerfile
image: apache_centos7_arm64
hostname: webserver
container_name: webserver_centos7_arm64
command: bash -c " httpd -k start && tail -f /dev/null "
profiles:
- centos7
ports:
- "9004:80"
depends_on:
- otel-collector
webserver_ubuntu:
build:
context: .
dockerfile: docker/ubuntu20.04/Dockerfile
platforms:
- "linux/amd64"
- "linux/arm64"
image: apache_ubuntu
hostname: webserver
container_name: webserver_ubuntu
Expand All @@ -52,13 +57,24 @@ services:
- "9000:80"
depends_on:
- otel-collector
webserver_ubuntu-arm64:
build:
context: .
dockerfile: docker/ubuntu20.04-arm64/Dockerfile
image: apache_ubuntu_arm64
hostname: webserver
container_name: webserver_ubuntu_arm64
command: bash -c "apache2ctl -k start && tail -f /dev/null "
profiles:
- ubuntu20.04
ports:
- "9000:80"
depends_on:
- otel-collector
nginx_centos:
build:
context: .
dockerfile: Dockerfile
platforms:
- "linux/amd64"
- "linux/arm64"
image: nginx_centos
hostname: webserver
container_name: nginx_centos
Expand All @@ -73,9 +89,6 @@ services:
build:
context: .
dockerfile: docker/centos7/Dockerfile
platforms:
- "linux/amd64"
- "linux/arm64"
image: nginx_centos7
hostname: webserver
container_name: nginx_centos7
Expand All @@ -86,13 +99,24 @@ services:
- "8012:80"
depends_on:
- otel-collector
nginx_centos7-arm64:
build:
context: .
dockerfile: docker/centos7/Dockerfile
image: nginx_centos7_arm64
hostname: webserver
container_name: nginx_centos7_arm64
command: bash -c "export LD_LIBRARY_PATH=/opt/opentelemetry-webserver-sdk/sdk_lib/lib && nginx && tail -f /dev/null"
profiles:
- centos7_nginx
ports:
- "8012:80"
depends_on:
- otel-collector
nginx_ubuntu:
build:
context: .
dockerfile: docker/ubuntu20.04/Dockerfile
platforms:
- "linux/amd64"
- "linux/arm64"
image: nginx_ubuntu
hostname: webserver
container_name: nginx_ubuntu
Expand All @@ -103,6 +127,20 @@ services:
- "8016:80"
depends_on:
- otel-collector
nginx_ubuntu-arm64:
build:
context: .
dockerfile: docker/ubuntu20.04-arm64/Dockerfile
image: nginx_ubuntu_arm64
hostname: webserver
container_name: nginx_ubuntu_arm64
command: bash -c "export LD_LIBRARY_PATH=/opt/opentelemetry-webserver-sdk/sdk_lib/lib && nginx && tail -f /dev/null"
profiles:
- ubuntu20.04_nginx
ports:
- "8016:80"
depends_on:
- otel-collector


# Collector
Expand Down
Loading

0 comments on commit 42626ad

Please sign in to comment.