Skip to content

Commit

Permalink
Replace /bin/sh with a wrapper to /bin/bash
Browse files Browse the repository at this point in the history
This is needed to be able to set umask=022 for the Linux aarch64
images that use umask=027 by default.

/bin/sh does not load /etc/profile nor any other rcfile.

See bioconda/bioconda-recipes#46177 for full
details and galaxyproject/galaxy#17631 for a
summary.

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
  • Loading branch information
martin-g committed Mar 11, 2024
1 parent ecfb6b5 commit 79df204
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/base-glibc-busybox-bash.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
# The base image is not intended to change often and should be used with
# version tags or checksum IDs, but not via "latest".
MAJOR_VERSION: 3
MINOR_VERSION: 0
MINOR_VERSION: 1
IMAGE_NAME: base-glibc-busybox-bash
BUSYBOX_VERSION: '1.36.1'
DEBIAN_VERSION: '12.2'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/base-glibc-debian-bash.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
# The base image is not intended to change often and should be used with
# version tags or checksum IDs, but not via "latest".
MAJOR_VERSION: 3
MINOR_VERSION: 0
MINOR_VERSION: 1
IMAGE_NAME: base-glibc-debian-bash
DEBIAN_VERSION: '12.2'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-22.04
env:
MAJOR_VERSION: 3
MINOR_VERSION: 0
MINOR_VERSION: 1
IMAGE_NAME: create-env

steps:
Expand Down
9 changes: 9 additions & 0 deletions images/base-glibc-busybox-bash/Dockerfile.busybox
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ RUN [ ! -f /etc/apt/sources.list ] || sed --in-place= --regexp-extended \
WORKDIR /build
COPY build-busybox ./
ARG busybox_version

RUN echo "umask 022" >> /etc/profile
RUN echo "umask 022" >> /root/.bashrc

# replace /bin/sh with a wrapper to /bin/bash
RUN /bin/bash -c "unlink /bin/sh"
COPY bin-sh-wrapper.sh /bin/sh
RUN /bin/bash -c "chmod +x /bin/sh"

RUN ./build-busybox \
"${busybox_version}" \
x86_64 aarch64
Expand Down
3 changes: 3 additions & 0 deletions images/base-glibc-busybox-bash/bin-sh-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

BASH_ENV=/etc/profile bash "$@"
9 changes: 9 additions & 0 deletions images/base-glibc-debian-bash/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,14 @@ RUN touch /usr/local/env-activate.sh \
> /usr/local/env-execute

ENV LANG=C.UTF-8

RUN echo "umask 022" >> /etc/profile
RUN echo "umask 022" >> /root/.bashrc

# replace /bin/sh with a wrapper to /bin/bash
RUN /bin/bash -c "unlink /bin/sh"
COPY bin-sh-wrapper.sh /bin/sh
RUN /bin/bash -c "chmod +x /bin/sh"

ENTRYPOINT [ "/usr/local/env-execute" ]
CMD [ "bash" ]
3 changes: 3 additions & 0 deletions images/base-glibc-debian-bash/bin-sh-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

BASH_ENV=/etc/profile bash "$@"
8 changes: 8 additions & 0 deletions images/create-env/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,13 @@ RUN \
>> /etc/skel/.bashrc
ENV ENV=/etc/profile.d/conda.sh

RUN echo "umask 022" >> /etc/profile
RUN echo "umask 022" >> /root/.bashrc

# replace /bin/sh with a wrapper to /bin/bash
RUN /bin/bash -c "unlink /bin/sh"
COPY bin-sh-wrapper.sh /bin/sh
RUN /bin/bash -c "chmod +x /bin/sh"

ENTRYPOINT [ "/opt/create-env/bin/tini", "--", "/opt/create-env/env-execute" ]
CMD [ "bash" ]
3 changes: 3 additions & 0 deletions images/create-env/bin-sh-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

BASH_ENV=/etc/profile bash "$@"

0 comments on commit 79df204

Please sign in to comment.