<commit_before>FROM buildpack-deps:18.04 as build_singularity

ENV SINGULARITY_VERSION=3.5.3
ENV GO_VERSION=1.13

# Install Go (only needed for building singularity)
RUN apt update && apt install --no-install-recommends cryptsetup-bin uuid-dev -y \
    && wget https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz \
    && tar -C /usr/local -xzvf go${GO_VERSION}.linux-amd64.tar.gz \
    && rm go${GO_VERSION}.linux-amd64.tar.gz
ENV PATH=/usr/local/go/bin:${PATH}

RUN wget https://github.com/sylabs/singularity/releases/download/v${SINGULARITY_VERSION}/singularity-${SINGULARITY_VERSION}.tar.gz \
    && tar -xzf singularity-${SINGULARITY_VERSION}.tar.gz \
    && cd singularity \
    && ./mconfig \
    && make -C builddir


FROM buildpack-deps:18.04 as galaxy_dependencies

ARG GALAXY_RELEASE=release_19.09
ARG GALAXY_REPO=https://github.com/galaxyproject/galaxy

ENV GALAXY_ROOT=/galaxy

# Download Galaxy source, but only keep necessary dependencies
RUN mkdir "${GALAXY_ROOT}" \
    && curl -L -s $GALAXY_REPO/archive/$GALAXY_RELEASE.tar.gz | tar xzf - --strip-components=1 -C $GALAXY_ROOT \
    && cd $GALAXY_ROOT \
    && ls . | grep -v "lib" | xargs rm -rf \
    && cd $GALAXY_ROOT/lib \
    && ls . | grep -v "galaxy\|galaxy_ext" | xargs rm -rf \
    && cd $GALAXY_ROOT/lib/galaxy \
    && ls . | grep -v "__init__.py\|datatypes\|exceptions\|metadata\|model\|util\|security" | xargs rm -rf


FROM ubuntu:18.04 as final

ENV GALAXY_USER=galaxy \
    GALAXY_GROUP=galaxy \
    GALAXY_UID=1450 \
    GALAXY_GID=1450 \
    GALAXY_HOME=/home/galaxy \
    GALAXY_ROOT=/galaxy

RUN groupadd -r $GALAXY_USER -g $GALAXY_GID \
    && useradd -u $GALAXY_UID -r -g $GALAXY_USER -d $GALAXY_HOME -c "Galaxy user" --shell /bin/bash $GALAXY_USER \
    && mkdir $GALAXY_HOME \
    && chown -R $GALAXY_USER:$GALAXY_USER $GALAXY_HOME

# Install Slurm
ENV SLURM_USER=galaxy \
    SLURM_UID=1450 \
    SLURM_GID=1450 \
    MUNGER_USER=munge \
    MUNGE_UID=1200 \
    MUNGE_GID=1200

RUN groupadd -r $MUNGER_USER -g $MUNGE_GID \
    && useradd -u $MUNGE_UID -r -g $MUNGER_USER $MUNGER_USER \
    && apt update \
    && apt install --no-install-recommends gosu munge python python-dev slurm-wlm -y \
    && rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/*

# Install Docker
RUN apt update \
    && apt install --no-install-recommends docker.io -y \
    && usermod -aG docker $GALAXY_USER

# Copy Galaxy dependencies
COPY --chown=$GALAXY_USER:$GALAXY_USER --from=galaxy_dependencies $GALAXY_ROOT $GALAXY_ROOT

# Install Singularity
COPY --from=build_singularity /singularity /singularity
RUN apt update \
    && apt install --no-install-recommends ca-certificates make squashfs-tools -y \
    && make -C /singularity/builddir install \
    && rm -rf /singularity \
    && sed -e '/bind path = \/etc\/localtime/s/^/#/g' -i /usr/local/etc/singularity/singularity.conf

COPY start.sh /usr/bin/start.sh

ENTRYPOINT [ "/usr/bin/start.sh" ]<commit_msg>Slurm: use container-base as base image<commit_after>ARG SETUP_REPO=andreassko
ARG IMAGE_TAG=latest

FROM buildpack-deps:18.04 as galaxy_dependencies

ARG GALAXY_RELEASE=release_19.09
ARG GALAXY_REPO=https://github.com/galaxyproject/galaxy

ENV GALAXY_ROOT=/galaxy

# Download Galaxy source, but only keep necessary dependencies
RUN mkdir "${GALAXY_ROOT}" \
    && curl -L -s $GALAXY_REPO/archive/$GALAXY_RELEASE.tar.gz | tar xzf - --strip-components=1 -C $GALAXY_ROOT \
    && cd $GALAXY_ROOT \
    && ls . | grep -v "lib" | xargs rm -rf \
    && cd $GALAXY_ROOT/lib \
    && ls . | grep -v "galaxy\|galaxy_ext" | xargs rm -rf \
    && cd $GALAXY_ROOT/lib/galaxy \
    && ls . | grep -v "__init__.py\|datatypes\|exceptions\|metadata\|model\|util\|security" | xargs rm -rf


FROM $SETUP_REPO/galaxy-container-base:$IMAGE_TAG as final

ENV GALAXY_USER=galaxy \
    GALAXY_GROUP=galaxy \
    GALAXY_UID=1450 \
    GALAXY_GID=1450 \
    GALAXY_HOME=/home/galaxy \
    GALAXY_ROOT=/galaxy

RUN groupadd -r $GALAXY_USER -g $GALAXY_GID \
    && useradd -u $GALAXY_UID -r -g $GALAXY_USER -d $GALAXY_HOME -c "Galaxy user" --shell /bin/bash $GALAXY_USER \
    && mkdir $GALAXY_HOME \
    && chown -R $GALAXY_USER:$GALAXY_USER $GALAXY_HOME

# Install Slurm
ENV SLURM_USER=galaxy \
    SLURM_UID=1450 \
    SLURM_GID=1450 \
    MUNGER_USER=munge \
    MUNGE_UID=1200 \
    MUNGE_GID=1200

RUN groupadd -r $MUNGER_USER -g $MUNGE_GID \
    && useradd -u $MUNGE_UID -r -g $MUNGER_USER $MUNGER_USER \
    && apt update \
    && apt install --no-install-recommends gosu munge python python-dev slurm-wlm -y \
    && rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/*

# Copy Galaxy dependencies
COPY --chown=$GALAXY_USER:$GALAXY_USER --from=galaxy_dependencies $GALAXY_ROOT $GALAXY_ROOT

COPY start.sh /usr/bin/start.sh

ENTRYPOINT [ "/usr/bin/start.sh" ]
{'fraction_non_alphanumeric': 0.13640167364016736, 'fraction_numerical': 0.01799163179916318, 'mean_word_length': 3.1537793223284103, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7371566', 'n_tokens_mistral': 2038, 'n_tokens_neox': 1883, 'n_words': 392}