Skip to content

Commit

Permalink
Merge pull request #3398 from AlexsLemonade/ark/docker-heredocs-refac…
Browse files Browse the repository at this point in the history
…toring

Update docker files: use heredocs syntax
  • Loading branch information
arkid15r authored Oct 2, 2023
2 parents 5139f7e + 7e98e1f commit 6304213
Show file tree
Hide file tree
Showing 13 changed files with 197 additions and 190 deletions.
12 changes: 8 additions & 4 deletions api/dockerfiles/Dockerfile.api
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ FROM $DOCKERHUB_REPO/dr_api_base:$SYSTEM_VERSION
# Fail in case of an error at any stage in the pipe.
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN pip install --ignore-installed --no-cache-dir uwsgi && \
chmod +x /home/user/collect_and_run_uwsgi.sh && \
mkdir -p /tmp/www/static && \
chown user /tmp/www/static
RUN <<EOF
pip install --ignore-installed --no-cache-dir uwsgi
chmod +x /home/user/collect_and_run_uwsgi.sh
mkdir -p /tmp/www/static
chown user /tmp/www/static
EOF

ENV SYSTEM_VERSION=$SYSTEM_VERSION

USER user

Expand Down
25 changes: 13 additions & 12 deletions api/dockerfiles/Dockerfile.api_base
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,28 @@ FROM python:3.8.5-buster
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Install gcc and libpq-dev for psycopg2.
RUN apt-get update -qq && \
apt-get install -y \
gcc \
libpq-dev && \
groupadd user && \
useradd --create-home --home-dir /home/user -g user user
RUN <<EOF
apt-get update -qq
apt-get install -y \
gcc \
libpq-dev
groupadd user
useradd --create-home --home-dir /home/user -g user user
EOF

WORKDIR /home/user

COPY api/requirements.txt .
RUN pip install --upgrade pip && \
pip install --ignore-installed --no-cache-dir -r requirements.txt
RUN <<EOF
pip install --upgrade pip
pip install --ignore-installed --no-cache-dir -r requirements.txt
EOF

COPY common/dist/data-refinery-common-* common/
RUN pip install --ignore-installed \
common/$(ls common -1 | sort --version-sort | tail -1)
RUN pip install --ignore-installed common/$(ls common -1 | sort --version-sort | tail -1)

COPY api/ .
COPY config/ config/
COPY setup.cfg .

ENV SYSTEM_VERSION=$SYSTEM_VERSION

ENTRYPOINT []
2 changes: 2 additions & 0 deletions api/dockerfiles/Dockerfile.api_local
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ FROM $DOCKERHUB_REPO/dr_api_base:$SYSTEM_VERSION
# Fail in case of an error at any stage in the pipe.
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ENV SYSTEM_VERSION=$SYSTEM_VERSION

USER user

EXPOSE 8000
Expand Down
103 changes: 52 additions & 51 deletions common/dockerfiles/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -12,57 +12,58 @@ ENV DEBIAN_FRONTEND=noninteractive
# For whatever reason this worked and 'en_US.UTF-8' did not.
ENV LANG=C.UTF-8

RUN apt-get update && \
apt-get install --no-install-recommends -y software-properties-common && \
add-apt-repository ppa:apt-fast/stable && \
add-apt-repository ppa:deadsnakes/ppa && \
add-apt-repository ppa:savoury1/llvm-defaults-10 && \
apt-get update -qq && \
apt-get install --no-install-recommends -y \
apt-fast \
apt-transport-https \
gpg-agent && \
apt-fast update -qq && apt-fast install -y \
build-essential \
cmake \
curl \
cython \
cython3 \
ed \
file \
git \
libcairo-dev \
libcurl4-gnutls-dev \
libedit-dev \
libfreetype6-dev \
libfribidi-dev \
libgit2-dev \
libharfbuzz-dev \
libjpeg-dev \
libpng-dev \
libpq-dev \
libssl-dev \
libtiff5-dev \
libxml2-dev \
llvm-10-dev \
lsb-release \
mercurial \
pkg-config \
python3-pip \
python3-pybind11 \
python3.8 \
python3.8-dev \
r-base-core \
wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
ln -s /usr/bin/llvm-config-10 /usr/bin/llvm-config && \
update-alternatives --install \
/usr/bin/python3 python3 /usr/bin/python3.8 1 && \
pip3 install --upgrade pip setuptools && \
groupadd user && \
useradd --create-home --home-dir /home/user/ -g user user && \
chown -R user /home/user/
RUN <<EOF
apt-get update
apt-get install --no-install-recommends -y software-properties-common
add-apt-repository ppa:apt-fast/stable
add-apt-repository ppa:deadsnakes/ppa
add-apt-repository ppa:savoury1/llvm-defaults-10
apt-get update -qq
apt-get install --no-install-recommends -y \
apt-fast \
apt-transport-https \
gpg-agent && \
apt-fast update -qq && apt-fast install -y \
build-essential \
cmake \
curl \
cython \
cython3 \
ed \
file \
git \
libcairo-dev \
libcurl4-gnutls-dev \
libedit-dev \
libfreetype6-dev \
libfribidi-dev \
libgit2-dev \
libharfbuzz-dev \
libjpeg-dev \
libpng-dev \
libpq-dev \
libssl-dev \
libtiff5-dev \
libxml2-dev \
llvm-10-dev \
lsb-release \
mercurial \
pkg-config \
python3-pip \
python3-pybind11 \
python3.8 \
python3.8-dev \
r-base-core \
wget
apt-get clean
rm -rf /var/lib/apt/lists/*
ln -s /usr/bin/llvm-config-10 /usr/bin/llvm-config
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
pip3 install --upgrade pip setuptools
groupadd user
useradd --create-home --home-dir /home/user/ -g user user
chown -R user /home/user/
EOF

ENV R_LIBS=/usr/local/lib/R/site-library

Expand Down
16 changes: 8 additions & 8 deletions foreman/dockerfiles/Dockerfile.foreman
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
WORKDIR /home/user

COPY foreman/requirements.txt .
RUN mkdir -p data/microarray && \
wget -q https://gbnci.cancer.gov/geo/GEOmetadb.sqlite.gz \
-O data/microarray/GEOmetadb.sqlite.gz && \
gunzip data/microarray/GEOmetadb.sqlite.gz && \
chmod 644 data/microarray/GEOmetadb.sqlite && \
pip3 install --ignore-installed --no-cache-dir -r requirements.txt
RUN <<EOF
mkdir -p data/microarray
wget -q https://gbnci.cancer.gov/geo/GEOmetadb.sqlite.gz -O data/microarray/GEOmetadb.sqlite.gz
gunzip data/microarray/GEOmetadb.sqlite.gz
chmod 644 data/microarray/GEOmetadb.sqlite
pip3 install --ignore-installed --no-cache-dir -r requirements.txt
EOF

# Get the latest version from the dist directory.
COPY common/dist/data-refinery-common-* common/
RUN pip3 install --ignore-installed --no-cache-dir \
common/$(ls common -1 | sort --version-sort | tail -1)
RUN pip3 install --ignore-installed --no-cache-dir common/$(ls common -1 | sort --version-sort | tail -1)

COPY .boto .boto
COPY foreman/ .
Expand Down
3 changes: 1 addition & 2 deletions workers/dockerfiles/Dockerfile.affymetrix
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ RUN pip3 install --ignore-installed --no-cache-dir -r requirements.txt

# Get the latest version from the dist directory.
COPY common/dist/data-refinery-common-* common/
RUN pip3 install --ignore-installed --no-cache-dir \
common/$(ls common -1 | sort --version-sort | tail -1)
RUN pip3 install --ignore-installed --no-cache-dir common/$(ls common -1 | sort --version-sort | tail -1)

COPY .boto .boto
COPY workers/ .
Expand Down
110 changes: 55 additions & 55 deletions workers/dockerfiles/Dockerfile.compendia
Original file line number Diff line number Diff line change
Expand Up @@ -15,53 +15,54 @@ ENV LANG=C.UTF-8

# RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
# via https://github.com/ilikenwf/apt-fast/issues/85#issuecomment-261640099
RUN echo debconf apt-fast/maxdownloads string 16 | debconf-set-selections && \
echo debconf apt-fast/dlflag boolean true | debconf-set-selections && \
echo debconf apt-fast/aptmanager string apt-get | debconf-set-selections && \
echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections && \
echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections && \
apt-get update -qq && \
apt-get install --no-install-recommends -y software-properties-common && \
add-apt-repository ppa:apt-fast/stable && \
add-apt-repository ppa:deadsnakes/ppa && \
add-apt-repository ppa:savoury1/llvm-defaults-10 && \
apt-get update -qq && \
apt-get install --no-install-recommends -y apt-fast apt-transport-https gpg-agent tzdata && \
apt-fast update -qq && \
apt-fast install -y \
build-essential \
cmake \
curl \
cython3 \
ed \
gfortran \
git \
libblas-dev \
libcairo-dev \
libcurl4-openssl-dev \
libedit-dev \
liblapack-dev \
libpq-dev \
libssl-dev \
libxml2-dev \
llvm-10-dev \
lsb-release \
mercurial \
pkg-config \
python3-pip \
python3-pybind11 \
python3.8 \
python3.8-dev \
r-base-core \
wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
ln -s /usr/bin/llvm-config-10 /usr/bin/llvm-config && \
update-alternatives --install /usr/bin/python3 python3 \
/usr/bin/python3.8 1 && \
pip3 install --upgrade pip setuptools && \
groupadd user && \
useradd --create-home --home-dir /home/user -g user user
RUN <<EOF
echo debconf apt-fast/maxdownloads string 16 | debconf-set-selections
echo debconf apt-fast/dlflag boolean true | debconf-set-selections
echo debconf apt-fast/aptmanager string apt-get | debconf-set-selections
echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections
echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections
apt-get update -qq
apt-get install --no-install-recommends -y software-properties-common
add-apt-repository ppa:apt-fast/stable
add-apt-repository ppa:deadsnakes/ppa
add-apt-repository ppa:savoury1/llvm-defaults-10
apt-get update -qq
apt-get install --no-install-recommends -y apt-fast apt-transport-https gpg-agent tzdata
apt-fast update -qq
apt-fast install -y \
build-essential \
cmake \
curl \
cython3 \
ed \
gfortran \
git \
libblas-dev \
libcairo-dev \
libcurl4-openssl-dev \
libedit-dev \
liblapack-dev \
libpq-dev \
libssl-dev \
libxml2-dev \
llvm-10-dev \
lsb-release \
mercurial \
pkg-config \
python3-pip \
python3-pybind11 \
python3.8 \
python3.8-dev \
r-base-core \
wget
apt-get clean
rm -rf /var/lib/apt/lists/*
ln -s /usr/bin/llvm-config-10 /usr/bin/llvm-config
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
pip3 install --upgrade pip setuptools
groupadd user
useradd --create-home --home-dir /home/user -g user user
EOF

WORKDIR /home/user

Expand All @@ -78,17 +79,16 @@ COPY workers/data_refinery_workers/processors/requirements.txt requirements.txt
RUN pip3 install --ignore-installed --no-cache-dir -r requirements.txt

# Install phantomjs.
RUN wget -q "https://bitbucket.org/ariya/phantomjs/downloads/\
phantomjs-2.1.1-linux-x86_64.tar.bz2" && \
tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /usr/local/share/ && \
ln -s /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs \
/usr/local/bin/ && \
rm phantomjs-2.1.1-linux-x86_64.tar.bz2
RUN <<EOF
wget -q https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /usr/local/share/
ln -s /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/
rm phantomjs-2.1.1-linux-x86_64.tar.bz2
EOF

# Get the latest version from the dist directory.
COPY common/dist/data-refinery-common-* common/
RUN pip3 install --ignore-installed --no-cache-dir \
common/$(ls common -1 | sort --version-sort | tail -1)
RUN pip3 install --ignore-installed --no-cache-dir common/$(ls common -1 | sort --version-sort | tail -1)

COPY .boto .boto
COPY config/ config/
Expand Down
26 changes: 15 additions & 11 deletions workers/dockerfiles/Dockerfile.downloaders
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,33 @@ COPY workers/data_refinery_workers/downloaders/requirements.txt .
RUN pip3 install --ignore-installed --no-cache-dir -r requirements.txt

# Install Aspera.
# Disable IPv6 to avoid "Cannot assign requested address" error.
RUN mkdir -m 700 ~/.gnupg/ && \
echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf && \
gpg --keyserver keyserver.ubuntu.com --recv-keys \
409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
curl -sSL https://get.rvm.io | bash -s stable --ruby --gems=aspera-cli
RUN <<EOF
gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s -- stable --gems=aspera-cli --path /home/user/rvm --ruby
EOF

USER user
RUN . /usr/local/rvm/scripts/rvm && \
ascli conf ascp install

RUN <<EOF
mkdir -m 700 ~.gnupg/
# Disable IPv6 to avoid "Cannot assign requested address" error.
echo "disable-ipv6" >> ~.gnupg/dirmngr.conf
. /home/user/rvm/scripts/rvm
ascli conf ascp install
EOF

USER root

# Get the latest version from the dist directory.
COPY common/dist/data-refinery-common-* common/
RUN pip3 install --ignore-installed --no-cache-dir \
common/$(ls common -1 | sort --version-sort | tail -1)
RUN pip3 install --ignore-installed --no-cache-dir common/$(ls common -1 | sort --version-sort | tail -1)

COPY .boto .boto
COPY workers/ .

RUN rm -rf /root/.cache/*

ENV PATH="$PATH:/home/user/.aspera/ascli/sdk"
ENV PATH="$PATH:/home/user/.aspera/sdk"
ENV SYSTEM_VERSION=$SYSTEM_VERSION

USER user
Expand Down
3 changes: 1 addition & 2 deletions workers/dockerfiles/Dockerfile.illumina
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ RUN pip3 install --ignore-installed --no-cache-dir -r requirements.txt

# Get the latest version from the dist directory.
COPY common/dist/data-refinery-common-* common/
RUN pip3 install --ignore-installed --no-cache-dir \
common/$(ls common -1 | sort --version-sort | tail -1)
RUN pip3 install --ignore-installed --no-cache-dir common/$(ls common -1 | sort --version-sort | tail -1)

COPY .boto .boto
COPY workers/ .
Expand Down
Loading

0 comments on commit 6304213

Please sign in to comment.