diff --git a/README.md b/README.md index ee544c50..b822c496 100644 --- a/README.md +++ b/README.md @@ -200,6 +200,7 @@ Available arguments for `docker build`: * HUGO_CMD - Commands passed to Hugo during build. Default *empty* * HUGO_DESTINATION_ARG - Location of output folder. Default: `/target` * HUGO_ENV_ARG - Selecting environment ("DEV"/"production"). Default: `DEV` +* HUGO_DIR - Selecting Hugo root directory. Default: `/src` ## Using CI image (0.77.0 or newer) diff --git a/src/docker/_imports/onbuild.df b/src/docker/_imports/onbuild.df index 9480f7f9..f09316f2 100644 --- a/src/docker/_imports/onbuild.df +++ b/src/docker/_imports/onbuild.df @@ -3,9 +3,11 @@ FROM main AS onbuild ONBUILD ARG HUGO_CMD ONBUILD ARG HUGO_DESTINATION_ARG ONBUILD ARG HUGO_ENV_ARG +ONBUILD ARG HUGO_DIR ONBUILD ENV HUGO_DESTINATION="${HUGO_DESTINATION_ARG:-/target}" \ HUGO_ENV="${HUGO_ENV_ARG:-DEV}" ONBUILD COPY . /src +ONBUILD WORKDIR ${HUGO_DIR:-/src} ONBUILD RUN hugo ${HUGO_CMD}