Skip to content

Commit 91f0101

Browse files
committed
Base final image on busybox, not scratch
As it turns out, few people will use this image just for the shells, and they need some barebones utils that busybox can provide. This adds almost no overhead. Additionally, we changed the entrypoint to be less sensible to changing the workdir when running the container.
1 parent 037bfb7 commit 91f0101

2 files changed

Lines changed: 6 additions & 11 deletions

File tree

Dockerfile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,11 @@ FROM debian:bookworm-slim AS builder
3333
RUN mkdir -p /deps/opt/shvr && \
3434
find /opt \( -type l -o -type f \) | sort -t'_' -k1,1 -k2Vr > /deps/opt/shvr/manifest.txt
3535

36-
# Find first shell in TARGETS and symlink it to /deps/bin/sh
37-
RUN first_shell=$(echo $TARGETS | cut -d' ' -f1) && \
38-
first_shell_opt_path=$(find /opt -type d -name "$first_shell*" | head -n1) && \
39-
first_shell_executable=$(find "$first_shell_opt_path" -type f -executable | head -n1) && \
40-
ln -s "$first_shell_executable" /deps/bin/sh
4136

42-
FROM scratch
37+
FROM busybox:stable-musl
4338

4439
# Copy helper script
45-
COPY "entrypoint.sh" "entrypoint.sh"
40+
COPY "entrypoint.sh" "/opt/shvr/entrypoint.sh"
4641

4742
# Setup environment
4843
ENV SHVR_DIR_OUT=/opt
@@ -52,4 +47,4 @@ FROM scratch
5247
COPY --from=builder "$SHVR_DIR_OUT" "$SHVR_DIR_OUT"
5348
COPY --from=builder /deps /
5449

55-
ENTRYPOINT [ "/bin/sh", "entrypoint.sh" ]
50+
ENTRYPOINT [ "/bin/sh", "/opt/shvr/entrypoint.sh" ]

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Multiple versions of multiple shells. Ideal for testing portable shell scripts.
1212
- **latest** - Contains the two most recent versions of each shell. Ideal for testing up to date scripts.
1313
- **all** - Everything we can build in a single image. Ideal for testing legacy and backwards compatible scripts.
1414

15+
Shells are built on debian-slim, and copied during multi-stage to a barebones
16+
busybox image (you get busybox tools + all shells).
17+
1518
## Basic Usage
1619

1720
List all shells:
@@ -80,9 +83,6 @@ $ docker run -it --rm "mymultishell"
8083

8184
You can pass a shorter list of versions instead of the full `$(sh shvr.sh targets)`.
8285

83-
The first shell in the list will be chosen to run the entrypoint.sh file for
84-
the image.
85-
8686
This is particularly useful if you want to test a version that we don't bundle
8787
by default, such as an old patch. Our scripts are able to build most
8888
intermediate versions without modifications, but we can't include them all in

0 commit comments

Comments
 (0)