Merge pull request #8717 from yosifkit/docs-dockerfile

Cleanup docs Dockerfile, so it matches best practices.
This commit is contained in:
Sven Dowideit 2014-10-28 16:25:50 -07:00
commit 321c85d03d
1 changed files with 43 additions and 33 deletions

View File

@ -1,49 +1,59 @@
# #
# See the top level Makefile in https://github.com/docker/docker for usage. # See the top level Makefile in https://github.com/docker/docker for usage.
# #
FROM debian:jessie FROM debian:jessie
MAINTAINER Sven Dowideit <SvenDowideit@docker.com> (@SvenDowideit) MAINTAINER Sven Dowideit <SvenDowideit@docker.com> (@SvenDowideit)
RUN apt-get update && apt-get install -y make python-pip python-setuptools vim-tiny git gettext python-dev libssl-dev RUN apt-get update \
&& apt-get install -y \
gettext \
git \
libssl-dev \
make \
python-dev \
python-pip \
python-setuptools \
vim-tiny
RUN pip install mkdocs RUN pip install mkdocs
# add MarkdownTools to get transclusion # add MarkdownTools to get transclusion
# (future development) # (future development)
#RUN easy_install -U setuptools #RUN easy_install -U setuptools
#RUN pip install MarkdownTools2 #RUN pip install MarkdownTools2
# this version works, the current versions fail in different ways # this version works, the current versions fail in different ways
RUN pip install awscli==1.4.4 pyopenssl==0.12 RUN pip install awscli==1.4.4 pyopenssl==0.12
# make sure the git clone is not an old cache - we've published old versions a few times now
ENV CACHE_BUST Jul2014
# get my sitemap.xml branch of mkdocs and use that for now # get my sitemap.xml branch of mkdocs and use that for now
RUN git clone https://github.com/SvenDowideit/mkdocs &&\ # commit hash of the newest commit of SvenDowideit/mkdocs on
cd mkdocs/ &&\ # docker-markdown-merge branch, it is used to break docker cache
git checkout docker-markdown-merge &&\ # see: https://github.com/SvenDowideit/mkdocs/tree/docker-markdown-merge
./setup.py install RUN git clone -b docker-markdown-merge https://github.com/SvenDowideit/mkdocs \
&& cd mkdocs/ \
&& git checkout ad32549c452963b8854951d6783f4736c0f7c5d5 \
&& ./setup.py install
ADD . /docs COPY . /docs
ADD MAINTAINERS /docs/sources/humans.txt COPY MAINTAINERS /docs/sources/humans.txt
WORKDIR /docs WORKDIR /docs
RUN VERSION=$(cat /docs/VERSION) &&\ RUN VERSION=$(cat VERSION) \
MAJOR_MINOR="${VERSION%.*}" &&\ && MAJOR_MINOR="${VERSION%.*}" \
for i in $(seq $MAJOR_MINOR -0.1 1.0) ; do echo "<li><a class='version' href='/v$i'>Version v$i</a></li>" ; done > /docs/sources/versions.html_fragment &&\ && for i in $(seq $MAJOR_MINOR -0.1 1.0); do \
GIT_BRANCH=$(cat /docs/GIT_BRANCH) &&\ echo "<li><a class='version' href='/v$i'>Version v$i</a></li>"; \
GITCOMMIT=$(cat /docs/GITCOMMIT) &&\ done > sources/versions.html_fragment \
AWS_S3_BUCKET=$(cat /docs/AWS_S3_BUCKET) &&\ && GIT_BRANCH=$(cat GIT_BRANCH) \
BUILD_DATE=$(date) &&\ && GITCOMMIT=$(cat GITCOMMIT) \
sed -i "s/\$VERSION/$VERSION/g" /docs/theme/mkdocs/base.html &&\ && AWS_S3_BUCKET=$(cat AWS_S3_BUCKET) \
sed -i "s/\$MAJOR_MINOR/v$MAJOR_MINOR/g" /docs/theme/mkdocs/base.html &&\ && BUILD_DATE=$(date) \
sed -i "s/\$GITCOMMIT/$GITCOMMIT/g" /docs/theme/mkdocs/base.html &&\ && sed -i "s/\$VERSION/$VERSION/g" theme/mkdocs/base.html \
sed -i "s/\$GIT_BRANCH/$GIT_BRANCH/g" /docs/theme/mkdocs/base.html &&\ && sed -i "s/\$MAJOR_MINOR/v$MAJOR_MINOR/g" theme/mkdocs/base.html \
sed -i "s/\$BUILD_DATE/$BUILD_DATE/g" /docs/theme/mkdocs/base.html &&\ && sed -i "s/\$GITCOMMIT/$GITCOMMIT/g" .heme/mkdocs/base.html \
sed -i "s/\$AWS_S3_BUCKET/$AWS_S3_BUCKET/g" /docs/theme/mkdocs/base.html && sed -i "s/\$GIT_BRANCH/$GIT_BRANCH/g" theme/mkdocs/base.html \
&& sed -i "s/\$BUILD_DATE/$BUILD_DATE/g" theme/mkdocs/base.html \
&& sed -i "s/\$AWS_S3_BUCKET/$AWS_S3_BUCKET/g" theme/mkdocs/base.html
# note, EXPOSE is only last because of https://github.com/docker/docker/issues/3525 EXPOSE 8000
EXPOSE 8000
CMD ["mkdocs", "serve"] CMD ["mkdocs", "serve"]