diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 000000000..42d71cbff --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,53 @@ +FROM ubuntu:18.04 + +## for apt to be noninteractive +ENV DEBIAN_FRONTEND noninteractive +ENV DEBCONF_NONINTERACTIVE_SEEN true + +RUN apt update -qqy +RUN apt-get install -qqy apt-utils + +RUN echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections; \ + echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections; \ + apt-get install -qqy --no-install-recommends tzdata + +## preesed tzdata, update package index, upgrade packages and install needed software +RUN apt-get install -qqy \ + build-essential \ + ca-certificates \ + cmake \ + dirmngr \ + git \ + make \ + python3 \ + python3-biopython \ + python3-biopython-sql \ + python3-pandas \ + python3-pip \ + python3-pysam \ + python3-setuptools \ + samtools \ + wget \ + zlib1g-dev +RUN apt-get clean +RUN pip3 install gffutils + + +# Install gosu +ENV GOSU_VERSION 1.12 +RUN set -eux; \ + dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ + wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ + chmod +x /usr/local/bin/gosu; \ +# verify that the binary works + gosu --version; \ + gosu nobody true + +RUN git clone --recursive https://github.com/AlgoLab/galig.git +RUN cd galig ; make prerequisites +RUN cd galig ; make + +VOLUME ["/data"] +COPY asgal-docker.sh /galig/asgal-docker.sh +ENV PATH=$PATH:/galig/asgal +ENTRYPOINT ["/galig/asgal-docker.sh"] diff --git a/asgal-docker.sh b/docker/asgal-docker.sh similarity index 58% rename from asgal-docker.sh rename to docker/asgal-docker.sh index 1794a43f1..9278b37d1 100755 --- a/asgal-docker.sh +++ b/docker/asgal-docker.sh @@ -1,9 +1,22 @@ #!/bin/bash +# Add local user +# with the same owner as /data +USER_ID=$(stat -c %u /data) +GROUP_ID=$(stat -c %g /data) + +echo "Starting with UID:GID $USER_ID:$GROUP_ID" +# We create user:group with the correct uid:gid +groupadd -g "$GROUP_ID" group +useradd --shell /bin/bash -u "$USER_ID" -g group -o -c "" -m user +export HOME=/ +chown --recursive "$USER_ID":"$GROUP_ID" /data + if [ -s /data/transcripts.fa ] then if [ -s /data/sample_2.fa ] then + gosu user:group \ /galig/asgal --multi \ -g /data/genome.fa \ -a /data/annotation.gtf \ @@ -12,6 +25,7 @@ then -t /data/transcripts.fa \ -o /data/output else + gosu user:group \ /galig/asgal --multi \ -g /data/genome.fa \ -a /data/annotation.gtf \ @@ -20,6 +34,7 @@ then -o /data/output fi else + gosu user:group \ /galig/asgal -g /data/genome.fa \ -a /data/annotation.gtf \ -s /data/sample_1.fa \ diff --git a/paper/Dockerfile b/paper/Dockerfile deleted file mode 100644 index 1107444fc..000000000 --- a/paper/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM ubuntu:18.04 - -RUN apt update && \ - apt install -y build-essential \ - cmake \ - make \ - wget \ - git \ - python3-pip \ - samtools \ - zlib1g-dev \ - python3 \ - python3-pip \ - python3-setuptools \ - python3-biopython \ - python3-biopython-sql \ - python3-pysam \ - python3-pandas \ - python3-setuptools ; \ - pip3 install gffutils - -VOLUME ["/data"] - -RUN git clone --recursive https://github.com/AlgoLab/galig.git ; \ - cd galig ; \ - make prerequisites ; \ - make - -ENTRYPOINT ["/galig/asgal-docker.sh"]