Dockerfile: fix links in same step as generating the files

For intermediate stages, it's generally ok to perform steps
separately, however in this case, fixing the links would
happen every time the HTML was generated, so we might as
well do it in the same step, to reduce the size of the local
build cache, as it was adding 54MB for each rebuild:

    IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
    7d97d86ae290        3 minutes ago       RUN /bin/sh -c find ${TARGET} -type f -name …   53.7MB              buildkit.dockerfile.v0
    <missing>           3 minutes ago       RUN /bin/sh -c jekyll build -d ${TARGET} # b…   375MB               buildkit.dockerfile.v0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-03-15 18:25:30 +01:00
parent a5ab6fa4f8
commit 07d410de21
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 2 additions and 2 deletions

View File

@ -71,8 +71,8 @@ COPY --from=upstream-resources /usr/src/app/md_source/. ./
# substitute the "{site.latest_engine_api_version}" in the title for the latest
# API docs, based on the latest_engine_api_version parameter in _config.yml
RUN ./_scripts/update-api-toc.sh
RUN jekyll build -d ${TARGET}
RUN find ${TARGET} -type f -name '*.html' | grep -vE "v[0-9]+\." | while read i; do sed -i 's#href="https://docs.docker.com/#href="/#g' "$i"; done
RUN jekyll build -d ${TARGET} \
&& find ${TARGET} -type f -name '*.html' | grep -vE "v[0-9]+\." | while read i; do sed -i 's#href="https://docs.docker.com/#href="/#g' "$i"; done
# This stage only contains the generated files. It can be used to host the