Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-13592 Reduce docker image size #3421

Open
wants to merge 8 commits into
base: v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build/ansible/pmm-docker/post-build.yml
talhabinrizwan marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
state: absent
loop:
- /srv/logs
- /tmp/RPMS
- /var/log/dnf.log
- /var/log/secure
- /var/log/wtmp
Expand Down
5 changes: 0 additions & 5 deletions build/ansible/roles/pmm-client/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
- name: Install the client
command: env PMM_USER=pmm PMM_GROUP=pmm /tmp/pmm-client/install_tarball

- name: Remove the tarball
file:
path: /tmp/pmm-client.tar.gz
state: absent

- name: Remove the temporary directory
file:
path: /tmp/pmm-client
Expand Down
11 changes: 5 additions & 6 deletions build/docker/server/Dockerfile.el9
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ ENV PS1="[\u@\h \W] # "

WORKDIR /opt

RUN microdnf -y install epel-release && \
RUN --mount=type=cache,target=/var/cache/dnf \
microdnf -y install epel-release && \
microdnf -y install ansible-core \
ansible-collection-community-general \
ansible-collection-community-postgresql \
Expand All @@ -21,13 +22,11 @@ RUN microdnf -y install epel-release && \

COPY entrypoint.sh /opt/entrypoint.sh
COPY ansible /opt/ansible
COPY RPMS /tmp/RPMS
COPY gitCommit /tmp/gitCommit

# Use COPY as we want to unarchive it with ansible
COPY pmm-client.tar.gz /tmp/

RUN install -T -p -m 644 /opt/ansible/ansible.cfg /etc/ansible/ansible.cfg && \
RUN --mount=type=bind,source=RPMS,target=/tmp/RPMS \
--mount=type=bind,source=pmm-client.tar.gz,target=/tmp/pmm-client.tar.gz \
install -T -p -m 644 /opt/ansible/ansible.cfg /etc/ansible/ansible.cfg && \
install -T -p -m 644 /opt/ansible/hosts /etc/ansible/hosts && \
ansible-playbook -vvv /opt/ansible/pmm-docker/main.yml && \
ansible-playbook -vvv /opt/ansible/pmm-docker/post-build.yml && \
Expand Down
11 changes: 9 additions & 2 deletions build/scripts/build-server-rpm
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ is_build_needed() {
if [ -n "$RPM_EPOCH" ]; then
aws s3 sync \
--region us-east-2 \
--no-progress \
--no-sign-request \
s3://pmm-build-cache/PR-BUILDS/${rpmbuild_dist}/${spec_name}-${rpm_version} \
${rpms_dir}/${spec_name}-${rpm_version}
else
aws s3 sync \
--region us-east-2 \
--no-progress \
--no-sign-request \
s3://pmm-build-cache/RELEASE/${rpmbuild_dist}/${spec_name}-${rpm_version} \
${rpms_dir}/${spec_name}-${rpm_version}
Expand Down Expand Up @@ -124,13 +126,16 @@ build() {
sleep 1
done

sudo yum-builddep -y SOURCES/${spec_name}.spec
if [[ ${spec_name} =~ ^grafana|^percona-dashboards ]]; then
sudo yum-builddep -y SOURCES/${spec_name}.spec
fi

spectool -C SOURCES -g SOURCES/${spec_name}.spec
rpmbuild --define '_rpmdir %{_topdir}/RPMS/${spec_name}-${rpm_version}' \
--define 'dist .${rpmbuild_dist}' \
--define 'debug_package %{nil}' \
-ba SOURCES/${spec_name}.spec
-bb SOURCES/${spec_name}.spec \
--rmspec

rm -f SOURCES/${spec_name}.spec*
sudo chown -R $(id -u):$(id -g) /home/builder/rpm/RPMS /home/builder/rpm/SOURCES
Expand All @@ -139,12 +144,14 @@ build() {
if [ -n "$RPM_EPOCH" ]; then
aws s3 sync \
--region us-east-2 \
--no-progress \
${rpms_dir}/${spec_name}-${rpm_version} \
s3://pmm-build-cache/PR-BUILDS/${rpmbuild_dist}/${spec_name}-${rpm_version} \
|| :
else
aws s3 sync \
--region us-east-2 \
--no-progress \
${rpms_dir}/${spec_name}-${rpm_version} \
s3://pmm-build-cache/RELEASE/${rpmbuild_dist}/${spec_name}-${rpm_version} \
|| :
Expand Down
Loading