Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace /bin/sh with a wrapper to /bin/bash #77

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ RUN [ "$( sh -lc 'printf world' )" = 'world' ] \
printf '' \
> /usr/local/env-activate.sh

# Check that the umask allows others to read+execute someoneelse's folders
RUN [ "$( umask )" = '0022' ]

RUN arch=$(uname -m) \
&& \
wget --quiet \
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/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ RUN [ "$( sh -lc 'printf world' )" = 'world' ] \
printf '' \
> /usr/local/env-activate.sh

# Check that the umask allows others to read+execute someoneelse's folders
RUN [ "$( umask )" = '0022' ]

# Check if all desired locales are there.
RUN locale -a | grep -i 'c\.utf-\?8' \
&& \
Expand Down
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 "$@"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one does not use BASH_ENV=/etc/profile because the current tests in Dockerfile.test use sh -lc ... and -l/--login causes double activation.

IMO all Dockerfiles should use BASH_ENV=/etc/profile and the tests should be adapted to not use -l.

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" ]
2 changes: 2 additions & 0 deletions images/create-env/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ RUN set -x && \
>&2 printf 'found static libraries\n' ; exit 1 \
; fi

# Check that the umask allows others to read+execute someoneelse's folders
RUN [ "$( umask )" = '0022' ]

FROM "${base}" as build_bioconda_package
RUN set -x && \
Expand Down
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 "$@"
Loading