From 3fbf071a24e8c03861d2d7c2357cc2752d2338c3 Mon Sep 17 00:00:00 2001 From: ivan-aksamentov Date: Wed, 11 Oct 2023 02:52:17 +0200 Subject: [PATCH] chore: fix docker docs build --- Makefile | 4 +--- docs/Dockerfile | 43 ++++++++++++++++++++++++------------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index c65f6e1d9..d3d93895d 100644 --- a/Makefile +++ b/Makefile @@ -52,10 +52,8 @@ docker-docs: --name=nextclade-docs-builder-$(shell date +%s) \ --init \ --user=$(shell id -u):$(shell id -g) \ - --volume=$(shell pwd):/home/user/src \ + --volume=$(shell pwd):/workdir \ --publish=8000:8000 \ - --workdir=/home/user/src \ - --env 'TERM=xterm-256colors' \ nextclade-docs-builder diff --git a/docs/Dockerfile b/docs/Dockerfile index d25829a0e..e31a9643c 100644 --- a/docs/Dockerfile +++ b/docs/Dockerfile @@ -1,4 +1,6 @@ -FROM continuumio/miniconda3:4.9.2 +FROM continuumio/miniconda3 + +SHELL ["bash", "--login", "-euxo", "pipefail", "-c"] ARG DEBIAN_FRONTEND=noninteractive ARG USER=user @@ -9,8 +11,20 @@ ARG GID ENV TERM="xterm-256color" ENV HOME="/home/user" + +RUN set -euxo pipefail >/dev/null \ +&& export DEBIAN_FRONTEND=noninteractive \ +&& apt-get update -qq --yes \ +&& apt-get install -qq --no-install-recommends --yes \ + make \ + sudo \ +>/dev/null \ +&& apt-get clean autoclean >/dev/null \ +&& apt-get autoremove --yes >/dev/null \ +&& rm -rf /var/lib/apt/lists/* + # Make a user and group -RUN set -x >/dev/null \ +RUN set -euxo pipefail >/dev/null \ && \ if [ -z "$(getent group ${GID})" ]; then \ addgroup --system --gid ${GID} ${GROUP}; \ @@ -34,27 +48,18 @@ RUN set -x >/dev/null \ && echo "%sudo ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ && echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ && touch ${HOME}/.hushlogin \ -&& chown -R ${UID}:${GID} "${HOME}" - -RUN set -x \ - && chown -R ${USER}:${GROUP} ${HOME} +&& chown -R ${UID}:${GID} "${HOME}" \ +&& chown -R ${USER}:${GROUP} ${HOME} -COPY environment.yml ${HOME}/src/ +WORKDIR /workdir -WORKDIR ${HOME}/src +COPY environment.yml /workdir -RUN set -x \ - && conda env create docs.clades.nextstrain.org +RUN set -euxo pipefail >/dev/null \ + && conda env create -n "docs.clades.nextstrain.org" USER ${USER} -RUN set -x \ - && conda init bash \ - && echo "conda activate docs.clades.nextstrain.org" >> ${HOME}/.bashrc +ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "docs.clades.nextstrain.org", "bash", "-euo", "pipefail", "-c"] -CMD bash -c "set -x \ - && source ${HOME}/.bashrc \ - && cd ${HOME}/src/docs \ - && rm -rf build \ - && make autobuild \ - " +CMD ["cd docs && make autobuild"]