-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed
Labels
Auto-AssignAuto assign by botAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamInstallationcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.feature-request
Milestone
Description
To make it short the docker image is far too big (> 1 GB) and there are several reasons for that:
# [...]
#-> install software, creates a layer ~190 MB
RUN apk add --no-cache bash openssh ca-certificates jq curl openssl perl git zip \
&& apk add --no-cache --virtual .build-deps gcc make openssl-dev libffi-dev musl-dev linux-headers \
&& apk add --no-cache libintl icu-libs libc6-compat \
&& apk add --no-cache bash-completion \
&& update-ca-certificates
ARG JP_VERSION="0.1.3"
#-> download jmespath, creates a layer ~4 MB
RUN curl -L https://github.com/jmespath/jp/releases/download/${JP_VERSION}/jp-linux-amd64 -o /usr/local/bin/jp \
&& chmod +x /usr/local/bin/jp
WORKDIR azure-cli
#-> uploading all the sourcecode, creating a layer ~20 MB
COPY . /azure-cli
#-> run installation, creating a layer ~880 MB
RUN ./scripts/install_full.sh \
&& cat /azure-cli/az.completion > ~/.bashrc \
&& runDeps="$( \
scanelf --needed --nobanner --recursive /usr/local \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| sort -u \
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --virtual .rundeps $runDeps
WORKDIR /
#-> removing sourcecode, which just creates another layer which marks all the previous added files as deleted ~1kb
RUN rm -rf ./azure-cli && \
dos2unix /root/.bashrc /usr/local/bin/azthe rm -rf command is increasing the size by marking all sourcefiles as deleted. you might want to use a multi stage build here for building and then creating the final image.
image was analyzed with dive which shows you all the added files: https://github.com/wagoodman/dive
also related to #23286
mthalman, ajostergaard, bruschke, Aj4x and akorp
Metadata
Metadata
Assignees
Labels
Auto-AssignAuto assign by botAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamInstallationcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.feature-request