Skip to content

Commit

Permalink
PMM-12899 optimize client and server docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
ademidoff committed Mar 17, 2024
1 parent 224eefe commit 4c17ca0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
18 changes: 9 additions & 9 deletions build/docker/client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ FROM redhat/ubi9-micro
ARG VERSION
ARG BUILD_DATE

LABEL org.opencontainers.image.created ${BUILD_DATE}
LABEL org.opencontainers.image.licenses Apache-2.0
LABEL org.opencontainers.image.title Percona Monitoring and Management Client
LABEL org.opencontainers.image.vendor Percona
LABEL org.opencontainers.image.version ${VERSION}
LABEL org.opencontainers.image.source https://github.com/percona/pmm/blob/main/build/docker/client/Dockerfile
LABEL org.opencontainers.image.docs https://docs.percona.com/percona-monitoring-and-management/setting-up/client/index.html#docker

COPY LICENSE /licenses/
COPY --from=users --chown=0:0 /etc/passwd /etc/passwd
COPY --from=users --chown=0:0 /etc/group /etc/group
Expand All @@ -34,10 +26,18 @@ RUN install -d -o pmm-agent -g pmm-agent -m 0775 /usr/local/percona/pmm2
ADD pmm2-client.tar.gz /tmp/

RUN cd /tmp/pmm2-client-* \
&& env PMM_USER=pmm-agent PMM_GROUP=root ./install_tarball \
&& PMM_USER=pmm-agent PMM_GROUP=root ./install_tarball \
&& cd /tmp \
&& rm -rf /tmp/pmm2-client*

LABEL org.opencontainers.image.created ${BUILD_DATE}
LABEL org.opencontainers.image.licenses Apache-2.0
LABEL org.opencontainers.image.title Percona Monitoring and Management Client
LABEL org.opencontainers.image.vendor Percona
LABEL org.opencontainers.image.version ${VERSION}
LABEL org.opencontainers.image.source https://github.com/percona/pmm/blob/main/build/docker/client/Dockerfile
LABEL org.opencontainers.image.docs https://docs.percona.com/percona-monitoring-and-management/setting-up/client/index.html#docker

USER pmm-agent
WORKDIR /usr/local/percona/pmm2/
ENV PATH /usr/local/percona/pmm2/bin/:$PATH
Expand Down
25 changes: 13 additions & 12 deletions build/docker/server/Dockerfile.el9
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ ENV LC_ALL=en_US.utf8
ENV GF_PLUGIN_DIR=/srv/grafana/plugins
ENV PS1="[\u@\h \W] # "

LABEL org.opencontainers.image.created ${BUILD_DATE}
LABEL org.opencontainers.image.licenses AGPL-3.0
LABEL org.opencontainers.image.title Percona Monitoring and Management
LABEL org.opencontainers.image.vendor Percona LLC
LABEL org.opencontainers.image.version ${VERSION}
LABEL org.opencontainers.image.source https://github.com/percona/pmm/blob/main/build/docker/server/Dockerfile.el9
LABEL org.opencontainers.image.docs https://docs.percona.com/percona-monitoring-and-management/setting-up/server/docker.html

EXPOSE 80 443

WORKDIR /opt
Expand All @@ -29,16 +21,25 @@ RUN microdnf -y install epel-release && \
yum \
vi

COPY RPMS /tmp/RPMS
COPY gitCommit /tmp/gitCommit

COPY ansible /opt/ansible
# NOTE: this needs to be refactored, since some of the playbooks are duplicates
RUN cp -r /opt/ansible/roles /opt/ansible/pmm2-docker/roles
COPY entrypoint.sh /opt/entrypoint.sh

COPY RPMS /tmp/RPMS
COPY gitCommit /tmp/gitCommit

RUN ansible-playbook -vvv -i 'localhost,' -c local /opt/ansible/pmm2-docker/main.yml \
&& ansible-playbook -vvv -i 'localhost,' -c local /usr/share/pmm-update/ansible/playbook/tasks/update.yml \
&& ansible-playbook -vvv -i 'localhost,' -c local /opt/ansible/pmm2/post-build-actions.yml

COPY entrypoint.sh /opt/entrypoint.sh
LABEL org.opencontainers.image.created ${BUILD_DATE}
LABEL org.opencontainers.image.licenses AGPL-3.0
LABEL org.opencontainers.image.title Percona Monitoring and Management
LABEL org.opencontainers.image.vendor Percona LLC
LABEL org.opencontainers.image.version ${VERSION}
LABEL org.opencontainers.image.source https://github.com/percona/pmm/blob/main/build/docker/server/Dockerfile.el9
LABEL org.opencontainers.image.docs https://docs.percona.com/percona-monitoring-and-management/setting-up/server/docker.html

HEALTHCHECK --interval=3s --timeout=2s --start-period=10s --retries=3 CMD curl -f http://127.0.0.1/v1/readyz || exit 1
CMD ["/opt/entrypoint.sh"]
4 changes: 2 additions & 2 deletions build/scripts/build-client-binary
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ gobuild_component() {
local component_path=$4
local result_file=${5:-bin/$(basename ${component_path:-$extract_path})}
local volume_mounts="-v ${tmp_dir}:/home/builder/tmp"
local src_dir=/home/builder/tmp/source/pmm2-client-${pmm_version}
local bin_dir=/home/builder/tmp/binary/pmm2-client-${pmm_version}
local src_dir=/home/builder/tmp/source/pmm2-client-${pmm_version} ## remember to change this for v3
local bin_dir=/home/builder/tmp/binary/pmm2-client-${pmm_version} ## remember to change this for v3

if [ -d "${root_dir}/go-build" ]; then
volume_mounts+=" -v ${root_dir}/go-build:/home/builder/.cache/go-build"
Expand Down

0 comments on commit 4c17ca0

Please sign in to comment.