Skip to content

Commit

Permalink
PMM-13592 Reduce docker image size (#3421)
Browse files Browse the repository at this point in the history
* PMM-13592 Reduce docker image size

* PMM-13592: trigger the build

* PMM-13592 Limit builddeps to two packages only

* PMM-13592 Don't remove the mounted filed

* PMM-13592 Don't copy the client tarball

* PMM-13592 Don't show progress on AWS S3 ops
  • Loading branch information
ademidoff authored Jan 14, 2025
1 parent d49e6d0 commit 5e69f01
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
exit $exit_code
fi
echo "$out" | bin/reviewdog -f=go-consistent -reporter=github-pr-review -fail-level=error
echo "$out" | bin/reviewdog -f=go-consistent -reporter=github-pr-review -fail-on-error
- name: Test common API
run: make test-common
Expand Down
1 change: 0 additions & 1 deletion build/ansible/pmm-docker/post-build.yml
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

0 comments on commit 5e69f01

Please sign in to comment.