diff --git a/Dockerfile.template b/Dockerfile.template index 99febb0d7..e6de2bb4d 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -1,4 +1,4 @@ -FROM python:${python_version}-slim as base +FROM python:${python_version}-alpine as base LABEL vendor=${vendor} LABEL name="${name}" @@ -11,8 +11,8 @@ LABEL build-date-iso8601="${build_date}" WORKDIR /root -COPY ${tar_path}/${tar_name} . -RUN ["pip", "install", "${tar_name}[full]"] +RUN --mount=type=bind,source=${tar_path}/${tar_name},target=/tmp/${tar_name} \ + pip install --no-cache-dir /tmp/${tar_name}[full] ENTRYPOINT ["b2"] CMD ["--help"] diff --git a/changelog.d/+docker_optimization.changed.md b/changelog.d/+docker_optimization.changed.md new file mode 100644 index 000000000..e5dcdabfa --- /dev/null +++ b/changelog.d/+docker_optimization.changed.md @@ -0,0 +1 @@ +Reduce docker image size, from 170MB to 87MB by using alpine and other build optimizations