Skip to content

Commit

Permalink
remove gosu
Browse files Browse the repository at this point in the history
by moving from gosu to setpriv we remove one external dependency, while
making the docker image smaller.
  • Loading branch information
gdv committed Apr 8, 2021
1 parent b751d3a commit 0bf36cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
14 changes: 2 additions & 12 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM ubuntu:20.04

## for apt to be noninteractive
ENV DEBIAN_FRONTEND noninteractive
Expand Down Expand Up @@ -27,22 +27,12 @@ RUN apt-get install -qqy \
python3-pysam \
python3-setuptools \
samtools \
util-linux \
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 --depth=1 --recursive https://github.com/AlgoLab/galig.git
RUN cd galig ; make prerequisites
RUN cd galig ; make
Expand Down
16 changes: 8 additions & 8 deletions docker/asgal-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ USER_ID=$(/usr/bin/stat -c %u /data)
GROUP_ID=$(/usr/bin/stat -c %g /data)

# When running as root, use a dummy command to change user
GOSU_CMD="gosu root:root"
SU_CMD="setpriv --reuid=root --regid=root"

# If the owner is not root, we create user:group with the correct uid:gid
if [ "$USER_ID" != "0" ]
Expand All @@ -15,7 +15,7 @@ then
groupadd -g "$GROUP_ID" group
useradd --shell /bin/bash -u "$USER_ID" -g group -o -c "" -m user
chown --recursive "$USER_ID":"$GROUP_ID" /data
GOSU_CMD="gosu user:group"
SU_CMD="setpriv --reuid=user --regid=group --init-groups"
fi
export HOME=/

Expand All @@ -27,7 +27,7 @@ then
then
if [ -s /data/sample_2.fq ]
then
$GOSU_CMD \
$SU_CMD \
/galig/asgal --multi \
-g /data/genome.fa \
-a /data/annotation.gtf \
Expand All @@ -36,7 +36,7 @@ then
-t /data/transcripts.fa \
-o /data/output
else
$GOSU_CMD \
$SU_CMD \
/galig/asgal --multi \
-g /data/genome.fa \
-a /data/annotation.gtf \
Expand All @@ -47,7 +47,7 @@ then
else
if [ -s /data/sample_2.fa ]
then
$GOSU_CMD \
$SU_CMD \
/galig/asgal --multi \
-g /data/genome.fa \
-a /data/annotation.gtf \
Expand All @@ -56,7 +56,7 @@ then
-t /data/transcripts.fa \
-o /data/output
else
$GOSU_CMD \
$SU_CMD \
/galig/asgal --multi \
-g /data/genome.fa \
-a /data/annotation.gtf \
Expand All @@ -68,13 +68,13 @@ then
else
if [ -s /data/sample_1.fq ]
then
$GOSU_CMD \
$SU_CMD \
/galig/asgal -g /data/genome.fa \
-a /data/annotation.gtf \
-s /data/sample_1.fq \
-o /data/output
else
$GOSU_CMD \
$SU_CMD \
/galig/asgal -g /data/genome.fa \
-a /data/annotation.gtf \
-s /data/sample_1.fa \
Expand Down

0 comments on commit 0bf36cb

Please sign in to comment.