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 c053475
Show file tree
Hide file tree
Showing 7 changed files with 34 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
10 changes: 10 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,16 @@ 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

SHELL ["/bin/bash", "-c"]
# replace /bin/sh with a wrapper to /bin/bash
RUN ls -la /bin/sh && unlink /bin/sh
COPY bin-sh-wrapper.sh /bin/sh
RUN chmod +x /bin/sh && ls -la /bin/sh && cat /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 -l "$@"
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

SHELL ["/bin/bash", "-c"]

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

# replace /bin/sh with a wrapper to /bin/bash
RUN unlink /bin/sh && echo 'bash -l "$@"' > /bin/sh && chmod +x /bin/sh

ENTRYPOINT [ "/usr/local/env-execute" ]
CMD [ "bash" ]
9 changes: 9 additions & 0 deletions images/create-env/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,14 @@ RUN \
>> /etc/skel/.bashrc
ENV ENV=/etc/profile.d/conda.sh

SHELL ["/bin/bash", "-c"]

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

# replace /bin/sh with a thin wrapper to /bin/bash
RUN unlink /bin/sh && echo 'bash -l "$@"' > /bin/sh && chmod +x /bin/sh


ENTRYPOINT [ "/opt/create-env/bin/tini", "--", "/opt/create-env/env-execute" ]
CMD [ "bash" ]

0 comments on commit c053475

Please sign in to comment.