feat(docker): add ability to always download latest or specific docker version
This commit is contained in:
parent
ff9b678d15
commit
cc9245a043
1 changed files with 20 additions and 5 deletions
25
Dockerfile
25
Dockerfile
|
|
@ -9,11 +9,26 @@ LABEL "repository"="https://github.com/peaceiris/actions-hugo"
|
||||||
LABEL "homepage"="https://github.com/peaceiris/actions-hugo"
|
LABEL "homepage"="https://github.com/peaceiris/actions-hugo"
|
||||||
LABEL "maintainer"="peaceiris"
|
LABEL "maintainer"="peaceiris"
|
||||||
|
|
||||||
ENV HUGO_VERSION='0.57.2'
|
ARG HUGO_VERSION="auto"
|
||||||
ENV HUGO_NAME="hugo_extended_${HUGO_VERSION}_Linux-64bit"
|
RUN echo "Hugo version: ${HUGO_VERSION}"
|
||||||
ENV HUGO_URL="https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/${HUGO_NAME}.tar.gz"
|
|
||||||
RUN wget "${HUGO_URL}" && \
|
RUN if [ "$HUGO_VERSION" = "auto" ]; then \
|
||||||
tar -zxvf "${HUGO_NAME}.tar.gz" && \
|
echo "Using automated version detection" && \
|
||||||
|
curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | \
|
||||||
|
grep browser_download_url | \
|
||||||
|
cut -d '"' -f 4 | \
|
||||||
|
grep -e 'hugo_extended_.*_Linux.*\.tar\.gz' | \
|
||||||
|
xargs curl -fsSL -O; fi
|
||||||
|
|
||||||
|
RUN if [ ! "$HUGO_VERSION" = "auto" ]; then \
|
||||||
|
echo "Using fixed version $HUGO_VERSION" && \
|
||||||
|
curl "https://api.github.com/repos/gohugoio/hugo/releases/tags/v${HUGO_VERSION}" | \
|
||||||
|
grep browser_download_url | \
|
||||||
|
cut -d '"' -f 4 | \
|
||||||
|
grep -e 'hugo_extended_.*_Linux.*\.tar\.gz' | \
|
||||||
|
xargs curl -fsSL -O; fi
|
||||||
|
|
||||||
|
RUN cat *.gz | tar -xzvf - -i && \
|
||||||
mv ./hugo /go/bin/
|
mv ./hugo /go/bin/
|
||||||
|
|
||||||
ENTRYPOINT [ "/go/bin/hugo" ]
|
ENTRYPOINT [ "/go/bin/hugo" ]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue