Dockerfile: use WORKDIR to simplify steps

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-03-06 15:02:29 +01:00
parent 3f165c6d32
commit d386c4cd2c
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
2 changed files with 9 additions and 27 deletions

View File

@ -13,16 +13,12 @@
# Get basic configs and Jekyll env
FROM docs/docker.github.io:docs-builder AS builder
# Set the target again
ENV TARGET=/usr/share/nginx/html
# Set the source directory to md_source
ENV SOURCE=md_source
ENV SOURCE=.
WORKDIR /usr/src/app/md_source/
# Get the current docs from the checked out branch
# ${SOURCE} will contain a directory for each archive
COPY . ${SOURCE}
COPY . .
####### START UPSTREAM RESOURCES ########
# Set vars used by fetch-upstream-resources.sh script
@ -38,13 +34,13 @@ ENV DISTRIBUTION_SVN_BRANCH="branches/release/2.6"
ENV DISTRIBUTION_BRANCH="release/2.6"
# Fetch upstream resources
RUN bash ./${SOURCE}/_scripts/fetch-upstream-resources.sh ${SOURCE}
RUN bash ./_scripts/fetch-upstream-resources.sh .
####### END UPSTREAM RESOURCES ########
# Build the static HTML, now that everything is in place
RUN jekyll build -s ${SOURCE} -d ${TARGET} --config ${SOURCE}/_config.yml
RUN jekyll build -d ${TARGET}
# Fix up some links, don't touch the archives
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

View File

@ -29,24 +29,10 @@ while getopts ":hl" opt; do
done
# Do some sanity-checking to make sure we are running this from the right place
if [ $LOCAL -eq 1 ]; then
SOURCE="."
if ! [ -f _config.yml ]; then
echo "Could not find _config.yml. We may not be in the right place. Bailing."
exit 1
fi
else
SOURCE="md_source"
if ! [ -d md_source ]; then
echo "Could not find md_source directory. We may not be running in the right place. Bailing."
exit 1
fi
fi
# Reasonable default to find the Markdown files
if [ -z "$SOURCE" ]; then
echo "No source passed in, assuming md_source/..."
SOURCE="md_source"
SOURCE="."
if ! [ -f _config.yml ]; then
echo "Could not find _config.yml. We may not be in the right place. Bailing."
exit 1
fi
echo "Operating on contents of $SOURCE"