mirror of https://github.com/docker/docs.git
Dockerfile: use WORKDIR to simplify steps
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
3f165c6d32
commit
d386c4cd2c
14
Dockerfile
14
Dockerfile
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue