Skip to content

Commit

Permalink
Update image structure based on design doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
humitos committed Aug 26, 2021
1 parent 3bc39b7 commit 9e57908
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 107 deletions.
48 changes: 25 additions & 23 deletions Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ RUN apt-get -y install \
subversion \
zlib1g-dev


# LaTeX -- split to reduce image layer size
RUN apt-get -y install \
texlive-fonts-extra
Expand Down Expand Up @@ -85,48 +84,51 @@ RUN apt-get -y install \
fonts-hanazono \
xindy

# pyenv extra requirements
# https://github.com/pyenv/pyenv/wiki/Common-build-problems
# asdf Python extra requirements
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment
RUN apt-get install -y \
liblzma-dev \
libncurses5-dev \
libncursesw5-dev \
libssl-dev \
libxmlsec1-dev \
llvm \
make \
python-openssl \
tk-dev \
wget \
xz-utils

# asdf nodejs extra requirements
# https://github.com/asdf-vm/asdf-nodejs#linux-debian
RUN apt install -y \
dirmngr \
gpg

# asdf Golang extra requirements
# https://github.com/kennyp/asdf-golang#linux-debian
RUN apt install -y \
coreutils

# UID and GID from readthedocs/user
RUN groupadd --gid 205 docs
RUN useradd -m --uid 1005 --gid 205 docs

USER docs
WORKDIR /home/docs

# Install pyenv
RUN wget https://github.com/pyenv/pyenv/archive/master.zip && \
unzip master.zip && \
rm -f master.zip && \
mv pyenv-master ~docs/.pyenv
ENV PYENV_ROOT /home/docs/.pyenv
ENV PATH /home/docs/.pyenv/shims:$PATH:/home/docs/.pyenv/bin
# Install asdf
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --depth 1 --branch v0.8.1
RUN echo ". /home/docs/.asdf/asdf.sh" >> ~/.bashrc
RUN echo ". /home/docs/.asdf/completions/asdf.bash" >> ~/.bashrc

# Install nodenv
RUN wget https://github.com/nodenv/nodenv/archive/master.zip && \
unzip master.zip && \
rm -f master.zip && \
mv nodenv-master ~docs/.nodenv
RUN cd ~/.nodenv && src/configure && make -C src
ENV PATH /home/docs/.nodenv/bin:$PATH
# Activate asdf in current session
ENV PATH /home/docs/.asdf/shims:/home/docs/.asdf/bin:$PATH

# Install node-build
RUN mkdir /home/docs/.nodenv/plugins
RUN wget https://github.com/nodenv/node-build/archive/master.zip && \
unzip master.zip && \
rm -f master.zip && \
mv node-build-master ~/.nodenv/plugins/node-build
# Install asdf plugins
RUN asdf plugin-add python
RUN asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
RUN asdf plugin-add rust https://github.com/code-lever/asdf-rust.git
RUN asdf plugin-add golang https://github.com/kennyp/asdf-golang.git

CMD ["/bin/bash"]
23 changes: 6 additions & 17 deletions Dockerfile.conda47
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
# Read the Docs - ubuntu20-conda47
FROM readthedocs/build:ubuntu20-base

# Install Conda
# Note: 4.7.12.1 drastically increases memory usage
ENV RTD_CONDA_VERSION 4.6.14
# Define Python versions to be installed via asdf
ENV RTD_PYTHON_VERSION miniconda3-4.7.12

WORKDIR /home/docs
# Labels for external usage
LABEL python.version=$RTD_PYTHON_VERSION

# Install supported Python versions
RUN pyenv install miniconda3-$RTD_CONDA_VERSION && \
pyenv global miniconda3-$RTD_CONDA_VERSION

WORKDIR /tmp

ENV RTD_MAMBA_VERSION 0.8.2
RUN pyenv local miniconda3-$RTD_CONDA_VERSION && \
pyenv exec conda install --channel conda-forge mamba==$RTD_MAMBA_VERSION

WORKDIR /home/docs

# Adding labels for external usage
LABEL conda.version=$RTD_CONDA_VERSION
RUN asdf install python $RTD_PYTHON_VERSION && \
asdf global python $RTD_PYTHON_VERSION

CMD ["/bin/bash"]
36 changes: 0 additions & 36 deletions Dockerfile.custom

This file was deleted.

14 changes: 14 additions & 0 deletions Dockerfile.mamba410
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Read the Docs - ubuntu20-mamba410
FROM readthedocs/build:ubuntu20-base

# Define Python versions to be installed via asdf
ENV RTD_PYTHON_VERSION mambaforge-4.10.1-5

# Labels for external usage
LABEL python.version=$RTD_PYTHON_VERSION

# Install supported Python versions
RUN asdf install python $RTD_PYTHON_VERSION && \
asdf global python $RTD_PYTHON_VERSION

CMD ["/bin/bash"]
29 changes: 16 additions & 13 deletions Dockerfile.py27
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
# Read the Docs - ubuntu20-py27
FROM readthedocs/build:ubuntu20-base

# Define Python versions to be installed via pyenv
ENV RTD_PYTHON_VERSION_27 2.7.18
# Define Python versions to be installed via asdf
ENV RTD_PYTHON_VERSION 2.7.18
ENV RTD_PIP_VERSION 20.0.1
ENV RTD_SETUPTOOLS_VERSION 44.0.0
ENV RTD_VIRTUALENV_VERSION 16.7.9

# Install supported Python versions
RUN pyenv install $RTD_PYTHON_VERSION_27 && \
pyenv global $RTD_PYTHON_VERSION_27
# Labels for external usage
LABEL python.version=$RTD_PYTHON_VERSION
LABEL python.pip=$RTD_PIP_VERSION
LABEL python.setuptools=$SETUPTOOLS_VERSION
LABEL python.virtualenv=$VIRTUALENV_VERSION

WORKDIR /tmp
# Install supported Python versions
RUN asdf install python $RTD_PYTHON_VERSION && \
asdf global python $RTD_PYTHON_VERSION

# Python2 dependencies are hardcoded because Python2 is
# deprecated. Updating them to their latest versions may raise
# incompatibility issues.
RUN pyenv local $RTD_PYTHON_VERSION_27 && \
pyenv exec pip install --no-cache-dir -U pip==20.0.1 && \
pyenv exec pip install --no-cache-dir -U setuptools==44.0.0 && \
pyenv exec pip install --no-cache-dir virtualenv==16.7.9

# Adding labels for external usage
LABEL python.version_27=$PYTHON_VERSION_27
RUN pip install --no-cache-dir -U pip==$RTD_PIP_VERSION && \
pip install --no-cache-dir -U setuptools==$RTD_SETUPTOOLS_VERSION && \
pip install --no-cache-dir virtualenv==$RTD_VIRTUALENV_VERSION

CMD ["/bin/bash"]
24 changes: 24 additions & 0 deletions Dockerfile.py38
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Read the Docs - ubuntu20-py39
FROM readthedocs/build:ubuntu20-base

# Define Python versions to be installed via asdf
ENV RTD_PYTHON_VERSION 3.8.11
ENV RTD_PIP_VERSION 21.2.4
ENV RTD_SETUPTOOLS_VERSION 57.4.0
ENV RTD_VIRTUALENV_VERSION 20.7.2

# Labels for external usage
LABEL python.version=$RTD_PYTHON_VERSION
LABEL python.pip=$RTD_PIP_VERSION
LABEL python.setuptools=$SETUPTOOLS_VERSION
LABEL python.virtualenv=$VIRTUALENV_VERSION

# Install supported Python versions
RUN asdf install python $RTD_PYTHON_VERSION && \
asdf global python $RTD_PYTHON_VERSION

RUN pip install --no-cache-dir -U pip==$RTD_PIP_VERSION && \
pip install --no-cache-dir -U setuptools==$RTD_SETUPTOOLS_VERSION && \
pip install --no-cache-dir virtualenv==$RTD_VIRTUALENV_VERSION

CMD ["/bin/bash"]
33 changes: 15 additions & 18 deletions Dockerfile.py39
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
# Read the Docs - ubuntu20-py39
FROM readthedocs/build:ubuntu20-base

ENV RTD_PYTHON_VERSION_39 3.9.0
# Define Python versions to be installed via asdf
ENV RTD_PYTHON_VERSION 3.9.6
ENV RTD_PIP_VERSION 21.2.4
ENV RTD_SETUPTOOLS_VERSION 57.4.0
ENV RTD_VIRTUALENV_VERSION 20.7.2

# Install supported Python versions
RUN pyenv install $RTD_PYTHON_VERSION_39 && \
pyenv global $RTD_PYTHON_VERSION_39

WORKDIR /tmp

ENV RTD_PIP_VERSION 21.0.1
ENV RTD_SETUPTOOLS_VERSION 45.1.0
ENV RTD_VIRTUALENV_VERSION 20.4.3

RUN pyenv local $RTD_PYTHON_VERSION_39 && \
pyenv exec pip install --no-cache-dir -U pip==$RTD_PIP_VERSION && \
pyenv exec pip install --no-cache-dir -U setuptools==$RTD_SETUPTOOLS_VERSION && \
pyenv exec pip install --no-cache-dir virtualenv==$RTD_VIRTUALENV_VERSION

# Adding labels for external usage
LABEL python.version_39=$PYTHON_VERSION_39
# Labels for external usage
LABEL python.version=$RTD_PYTHON_VERSION
LABEL python.pip=$RTD_PIP_VERSION
LABEL python.setuptools=$SETUPTOOLS_VERSION
LABEL python.virtualenv=$VIRTUALENV_VERSION

# Install supported Python versions
RUN asdf install python $RTD_PYTHON_VERSION && \
asdf global python $RTD_PYTHON_VERSION

RUN pip install --no-cache-dir -U pip==$RTD_PIP_VERSION && \
pip install --no-cache-dir -U setuptools==$RTD_SETUPTOOLS_VERSION && \
pip install --no-cache-dir virtualenv==$RTD_VIRTUALENV_VERSION

CMD ["/bin/bash"]

0 comments on commit 9e57908

Please sign in to comment.