Skip to content

Commit

Permalink
new /ls2 script location
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcgough committed Feb 9, 2018
1 parent 9fa0590 commit 8e7d5fd
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 59 deletions.
61 changes: 35 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
FROM fredhutch/ls2_easybuild_foss:2016b
FROM fredhutch/ls2_easybuild_toolchain:foss-2016b

# Remember the default use is LS2_USERNAME, not root

# DEPLOY_PREFIX comes from ls2_lmod container, two containers up!

# easyconfig to build - leave '.eb' off
ARG EB_NAME
ENV EB_NAME=${EB_NAME}

# libibverbs required for foss toolchains
ENV INSTALL_OS_PKGS ""

# easyconfig to build
ENV EASYCONFIG_NAME my_best_easyconfig.eb
# required OS packages for the build
ENV INSTALL_OS_PKGS "awscli build-essential pkg-config libssl-dev unzip libc6-dev"
# os pkg list to be removed after the build - in EasyBuild, the 'dummy' toolchain requires build-essential
# also, the current toolchain we are using (foss-2016b) does not actually include 'make'
# removing build-essential will mean the resulting container cannot build additional software
ENV UNINSTALL_OS_PKGS "build-essential"
# switch to our non-root user
USER neo
# copy in AWS Batch's "fetch-and-run" for S3-based scripts
COPY aws-batch-helpers/fetch-and-run/fetch_and_run.sh /home/neo/fetch_and_run.sh
# copy in easyconfigs (so many due to missing dependencies in existing easyconfigs)
COPY easyconfigs/* /app/fh_easyconfigs/
# R sources that cannot be programmatically downloaded
COPY sources/* /app/sources/
# run script to download larger sources
RUN /bin/bash /app/sources/download_sources.sh
# install build-essential, build R, remove build-essential
# EVERYTHING beyond build-essential needs to be moved into EB!!!
ENV UNINSTALL_OS_PKGS ""

# copy install and deploy scripts in
COPY install.sh /ls2/
COPY deploy.sh /ls2/

# install and uninstall build-essential in one step to reduce layer size
# while installing Lmod, again must be root
USER root
RUN apt-get update -y && apt-get install -y $INSTALL_OS_PKGS && \
su -c ". /app/lmod/lmod/init/bash && \
module use /app/modules/all && \
module load EasyBuild && \
eb -l $EASYCONFIG_NAME --robot" - neo && \
apt-get remove -y --purge $UNINSTALL_OS_PKGS && \
apt-get autoremove -y
USER neo
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update -y \
&& apt-get install -y ${INSTALL_OS_PKGS} \
&& su -c "/bin/bash /ls2/install.sh" ${LS2_USERNAME} \
&& AUTO_ADDED_PKGS=$(apt-mark showauto) apt-get remove -y --purge ${UNINSTALL_OS_PKGS} ${AUTO_ADDED_PKGS} \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

# gather installed pkgs list
RUN dpkg -l > /ls2/installed_pkgs.${EB_NAME}

# switch to LS2 user for future actions
USER ${LS2_USERNAME}
WORKDIR /home/${LS2_USERNAME}
SHELL ["/bin/bash", "-c"]

32 changes: 0 additions & 32 deletions Dockerfile.deploy

This file was deleted.

21 changes: 21 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# required env vars: OUT_UID, OUT_GID, DEPLOY_PREFIX

set -x
set -e

groupadd -g $OUT_GID outside_group
useradd -u $OUT_UID -g outside_group outside_user

apt-get update -y
apt-get install -y build-essential

su -c "/bin/bash /ls2/install.sh" outside_user

su -c "source ${DEPLOY_PREFIX}/lmod/lmod/init/bash \
&& ${DEPLOY_PREFIX}/lmod/lmod/libexec/update_lmod_system_cache_files ${DEPLOY_PREFIX}/modules/all" outside_user

AUTO_ADDED_PKGS=$(apt-mark showauto) apt-get remove -y --purge build-essential ${AUTO_ADDED_PKGS}
apt-get autoremove -y
rm -rf /var/lib/apt/lists/*
20 changes: 20 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -x
set -e

# variables used: TOOLCHAIN, DEPLOY_PREFIX

# try to preserve group write here
umask 002

# load modules
source ${DEPLOY_PREFIX}/lmod/lmod/init/bash
module use ${DEPLOY_PREFIX}/modules/all

# load Easybuild
module load EasyBuild

# build the easyconfig file
eb -l ${TOOLCHAIN}.eb --robot

2 changes: 1 addition & 1 deletion sources/download_sources.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

# script to download sources too large to fit into a git repo
curl -o /app/sources/jdk-8u92-linux-x64.tar.gz https://s3-us-west-2.amazonaws.com/ls2-sources/jdk-8u92-linux-x64.tar.gz
#curl -o /app/sources/jdk-8u92-linux-x64.tar.gz https://s3-us-west-2.amazonaws.com/ls2-sources/jdk-8u92-linux-x64.tar.gz

0 comments on commit 8e7d5fd

Please sign in to comment.