Skip to content

Commit

Permalink
Cleanup docker images / workflow
Browse files Browse the repository at this point in the history
Motivation:

Docker images can be quite large, lets try to cleanup things we not
need.

Modifications:

Cleanup things during docker image creation
Remove docker layer caching
Remove action that free disk space

Result:
Docker image needs less disk-space
  • Loading branch information
normanmaurer committed Sep 19, 2023
1 parent 4061518 commit 60e5ed4
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 73 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ jobs:

name: ${{ matrix.setup }}
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

- uses: actions/checkout@v3

# Cache .m2/repository
Expand All @@ -61,14 +54,6 @@ jobs:
restore-keys: |
build-${{ matrix.setup }}-cache-m2-repository-
# Enable caching of Docker layers
- uses: jpribyl/[email protected]
continue-on-error: true
with:
key: build-${{ matrix.setup }}-docker-cache-{hash}
restore-keys: |
build-${{ matrix.setup }}-docker-cache-
- name: Build docker image
run: docker-compose ${{ matrix.docker-compose-build }}

Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/ci-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ jobs:
docker-compose-run: "-f docker/docker-compose.centos-7.yaml run cross-compile-aarch64-stage-snapshot"
name: stage-snapshot-${{ matrix.setup }}
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

- uses: actions/checkout@v3

# Cache .m2/repository
Expand All @@ -60,16 +53,6 @@ jobs:
restore-keys: |
stage-snapshot-${{ matrix.setup }}-cache-m2-repository-
# Enable caching of Docker layers
- uses: jpribyl/[email protected]
env:
docker-cache-name: staging-${{ matrix.setup }}-cache-docker
continue-on-error: true
with:
key: ${{ runner.os }}-staging-${{ env.docker-cache-name }}-{hash}
restore-keys: |
${{ runner.os }}-staging-${{ env.docker-cache-name }}-
- name: Create local staging directory
run: mkdir -p ~/local-staging

Expand All @@ -90,13 +73,6 @@ jobs:
# Wait until we have staged everything
needs: stage-snapshot
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

- uses: actions/checkout@v3

- name: Set up JDK 8
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ jobs:

name: ${{ matrix.setup }}
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

- uses: actions/checkout@v3

# Cache .m2/repository
Expand All @@ -83,14 +76,6 @@ jobs:
restore-keys: |
build-pr-${{ matrix.setup }}-cache-m2-repository-
# Enable caching of Docker layers
- uses: jpribyl/[email protected]
continue-on-error: true
with:
key: pr-${{ matrix.setup }}-docker-cache-{hash}
restore-keys: |
pr-${{ matrix.setup }}-docker-cache-
- name: Build docker image
run: docker-compose ${{ matrix.docker-compose-build }}

Expand Down
17 changes: 0 additions & 17 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,6 @@ jobs:
docker-compose-run: "-f docker/docker-compose.centos-7.yaml run cross-compile-aarch64-stage-release"
name: stage-release-${{ matrix.setup }}
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

- name: Download release-workspace
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -123,16 +116,6 @@ jobs:
- name: Create local staging directory
run: mkdir -p ~/local-staging

# Enable caching of Docker layers
- uses: jpribyl/[email protected]
env:
docker-cache-name: staging-${{ matrix.setup }}-cache-docker
continue-on-error: true
with:
key: ${{ runner.os }}-staging-${{ env.docker-cache-name }}-{hash}
restore-keys: |
${{ runner.os }}-staging-${{ env.docker-cache-name }}-
- name: Build docker image
working-directory: ./prepare-release-workspace/
run: docker-compose ${{ matrix.docker-compose-build }}
Expand Down
4 changes: 4 additions & 0 deletions docker/Dockerfile.centos6
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ RUN echo 'PATH=/root/.sdkman/candidates/java/current/bin:$PATH' >> ~/.bashrc
# Prepare our own build
ENV PATH /root/.sdkman/candidates/maven/current:$PATH
ENV JAVA_HOME /root/.sdkman/candidates/java/current/

# Cleanup
RUN yum clean all && \
rm -rf /var/cache/yum
13 changes: 11 additions & 2 deletions docker/Dockerfile.centos7
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM centos:7.9.2009
ARG gcc_version=10.2-2020.11
ENV GCC_VERSION $gcc_version
ENV MAVEN_VERSION 3.9.1
ENV SOURCE_DIR /root/source

# Install requirements
RUN yum install -y \
Expand Down Expand Up @@ -38,13 +39,21 @@ RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && \
RUN echo 'export JAVA_HOME="/root/.sdkman/candidates/java/current"' >> ~/.bashrc
RUN echo 'PATH=/root/.sdkman/candidates/java/current/bin:$PATH' >> ~/.bashrc

WORKDIR /opt
RUN mkdir $SOURCE_DIR
WORKDIR $SOURCE_DIR

# Install aarch64 gcc 10.2 toolchain
RUN wget https://developer.arm.com/-/media/Files/downloads/gnu-a/$GCC_VERSION/binrel/gcc-arm-$GCC_VERSION-x86_64-aarch64-none-linux-gnu.tar.xz && \
tar xvf gcc-arm-$GCC_VERSION-x86_64-aarch64-none-linux-gnu.tar.xz
tar xvf gcc-arm-$GCC_VERSION-x86_64-aarch64-none-linux-gnu.tar.xz && \
mv gcc-arm-$GCC_VERSION-x86_64-aarch64-none-linux-gnu /opt/
ENV PATH="/opt/gcc-arm-$GCC_VERSION-x86_64-aarch64-none-linux-gnu/bin:${PATH}"

# Prepare our own build
ENV PATH /root/.sdkman/candidates/maven/current:$PATH
ENV JAVA_HOME /root/.sdkman/candidates/java/current/


# Cleanup
RUN rm -rf $SOURCE_DIR
RUN yum clean all && \
rm -rf /var/cache/yum
4 changes: 4 additions & 0 deletions docker/Dockerfile.centos7arm64v8
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ RUN echo 'PATH=/root/.sdkman/candidates/java/current/bin:$PATH' >> ~/.bashrc
# Prepare our own build
ENV PATH /root/.sdkman/candidates/maven/current:$PATH
ENV JAVA_HOME /root/.sdkman/candidates/java/current/

# Cleanup
RUN yum clean all && \
rm -rf /var/cache/yum

0 comments on commit 60e5ed4

Please sign in to comment.