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

Simplify images #11

Merged
merged 1 commit into from
Jul 4, 2024
Merged
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
1,029 changes: 3 additions & 1,026 deletions .github/workflows/docker-build.yml

Large diffs are not rendered by default.

1,038 changes: 6 additions & 1,032 deletions .github/workflows/docker-push.yml

Large diffs are not rendered by default.

56 changes: 17 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,35 @@
# alganet/shell-versions

[![Docker Build](https://github.com/alganet/shell-versions/actions/workflows/docker.yml/badge.svg?branch=main)](https://github.com/alganet/shell-versions/actions/workflows/docker.yml)
[![Docker Build](https://github.com/alganet/shell-versions/actions/workflows/docker-push.yml/badge.svg?branch=main)](https://github.com/alganet/shell-versions/actions/workflows/docker-push.yml)

Multiple versions of multiple shells.
Multiple versions of multiple shells. Ideal for testing portable shell scripts.

## Multiple Shell Image (~40MB)
## Images

- [multi](https://hub.docker.com/r/alganet/shell-versions/tags?page=1&ordering=name&name=multi-) - The latest supported version of each supported shell
- **latest** - Contains the two most recent versions of each shell. Ideal for testing up to date scripts.
- **all** - Everything we can build in a single image. Ideal for testing legacy and backwards compatible scripts.

You can list the shells in your image:

```sh
$ docker run -it --rm alganet/shell-versions find /opt -type f
/opt/posh_0.14.1/bin/posh
/opt/dash_0.5.11/bin/dash
/opt/yash_2.53/bin/yash
/opt/zsh_5.9/bin/zsh
/opt/osh_0.14.0/bin/osh
/opt/busybox_1.36.0/bin/busybox
/opt/loksh_7.2/bin/loksh
/opt/ksh_93u+m-v1.0.4/bin/ksh
/opt/ksh_93u+m-v1.0.4/bin/shcomp
/opt/bash_5.2.15/bin/bash
/opt/oksh_7.2/bin/oksh
/opt/mksh_R59c/bin/mksh
/opt/dash_0.5.11/bin/dash
...
```

And run them by choosing a version:

```sh
$ docker run -it --rm alganet/shell-versions /opt/bash_5.2.15/bin/bash -c "echo hello there"
hello there
```

## Single Shell Images (~30MB each)

- [bash](https://hub.docker.com/r/alganet/shell-versions/tags?page=1&ordering=name&name=bash-)
- [busybox](https://hub.docker.com/r/alganet/shell-versions/tags?page=1&ordering=name&name=busybox-) - Only the `ash` and `hush` applets and their dependencies are built.
- [dash](https://hub.docker.com/r/alganet/shell-versions/tags?page=1&ordering=name&name=dash-)
- [gwsh](https://hub.docker.com/r/alganet/shell-versions/tags?page=1&ordering=name&name=gwsh-)
- [ksh](https://hub.docker.com/r/alganet/shell-versions/tags?page=1&ordering=name&name=ksh-) - `shcomp` is also available.
- [loksh](https://hub.docker.com/r/alganet/shell-versions/tags?page=1&ordering=name&name=loksh-)
- [mksh](https://hub.docker.com/r/alganet/shell-versions/tags?page=1&ordering=name&name=mksh-)
- [oksh](https://hub.docker.com/r/alganet/shell-versions/tags?page=1&ordering=name&name=oksh-)
- [osh](https://hub.docker.com/r/alganet/shell-versions/tags?page=1&ordering=name&name=osh-)
- [posh](https://hub.docker.com/r/alganet/shell-versions/tags?page=1&ordering=name&name=posh-)
- [yash](https://hub.docker.com/r/alganet/shell-versions/tags?page=1&ordering=name&name=yash-)
- [zsh](https://hub.docker.com/r/alganet/shell-versions/tags?page=1&ordering=name&name=zsh-)

Check out the [full list of tags](https://hub.docker.com/r/alganet/shell-versions/tags).


## Building Locally

You can pass a list of versions to `TARGETS=` or use `sh shvr.sh [current|targets]` to let the script generate a list for you:

```sh
$ docker build -t "mydash" --build-arg TARGETS="dash_0.5.12" .
$ docker run -it --rm mydash ls /opt
$ docker build -t "mymultishell" --build-arg TARGETS="$(sh shvr.sh targets)" .
$ docker run -it --rm "mymultishell" ls /opt
```

You can pass multiple targets separated by space, see a list of possible ones on the `.github/workflows/docker.yml` file.

Each script on the `variants` folder should be able to handle new versions of each shell as they come out.
9 changes: 9 additions & 0 deletions shvr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ shvr_targets ()
shvr_each targets "${@:-}"
}

shvr_current ()
{
if test -z "$*"
then set -- $(printf '%s ' $(shvr_interpreters))
fi

shvr_each current "${@:-}"
}

shvr_interpreters ()
{
find "${SHVR_DIR_SELF}/variants" -type f |
Expand Down
8 changes: 8 additions & 0 deletions variants/bash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
# Copyright (c) Alexandre Gomes Gaigalas <[email protected]>
# SPDX-License-Identifier: ISC

shvr_current_bash ()
{
cat <<-@
bash_5.2.21
bash_5.1.16
@
}

shvr_targets_bash ()
{
cat <<-@
Expand Down
8 changes: 8 additions & 0 deletions variants/busybox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
# Copyright (c) Alexandre Gomes Gaigalas <[email protected]>
# SPDX-License-Identifier: ISC

shvr_current_busybox ()
{
cat <<-@
busybox_1.36.1
busybox_1.35.0
@
}

shvr_targets_busybox ()
{
cat <<-@
Expand Down
8 changes: 8 additions & 0 deletions variants/dash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
# Copyright (c) Alexandre Gomes Gaigalas <[email protected]>
# SPDX-License-Identifier: ISC

shvr_current_dash ()
{
cat <<-@
dash_0.5.12
dash_0.5.11.5
@
}

shvr_targets_dash ()
{
cat <<-@
Expand Down
44 changes: 0 additions & 44 deletions variants/gwsh.sh

This file was deleted.

57 changes: 33 additions & 24 deletions variants/ksh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,42 @@
# Copyright (c) Alexandre Gomes Gaigalas <[email protected]>
# SPDX-License-Identifier: ISC

shvr_current_ksh ()
{
cat <<-@
ksh_shvrA93uplusm-v1.0.9
ksh_shvrA93uplusm-v1.0.8
@
}

alganet marked this conversation as resolved.
Show resolved Hide resolved
shvr_targets_ksh ()
{
cat <<-@
ksh_93u+m-v1.0.8
ksh_93u+m-v1.0.7
ksh_93u+m-v1.0.6
ksh_93u+m-v1.0.4
ksh_93u+m-v1.0.3
ksh_93u+m-v1.0.2
ksh_93u+m-v1.0.1
ksh_2020-2020.0.0
ksh_history-b_2016-01-10
ksh_history-b_2012-08-01
ksh_history-b_2011-03-10
ksh_history-b_2010-10-26
ksh_history-b_2010-06-21
ksh_history-b_2008-11-04
ksh_history-b_2008-06-08
ksh_history-b_2008-02-02
ksh_history-b_2007-01-11
ksh_history-b_2006-11-15
ksh_history-b_2006-07-24
ksh_history-b_2006-02-14
ksh_history-b_2005-09-16
ksh_history-b_2005-06-01
ksh_history-b_2005-02-02
ksh_history-b_2004-10-11
ksh_shvrA93uplusm-v1.0.9
ksh_shvrA93uplusm-v1.0.8
ksh_shvrA93uplusm-v1.0.7
ksh_shvrA93uplusm-v1.0.6
ksh_shvrA93uplusm-v1.0.4
ksh_shvrA93uplusm-v1.0.3
ksh_shvrA93uplusm-v1.0.2
ksh_shvrA93uplusm-v1.0.1
ksh_shvrB2020-2020.0.0
ksh_shvrChistory-b_2016-01-10
ksh_shvrChistory-b_2012-08-01
ksh_shvrChistory-b_2011-03-10
ksh_shvrChistory-b_2010-10-26
ksh_shvrChistory-b_2010-06-21
ksh_shvrChistory-b_2008-11-04
ksh_shvrChistory-b_2008-06-08
ksh_shvrChistory-b_2008-02-02
ksh_shvrChistory-b_2007-01-11
ksh_shvrChistory-b_2006-11-15
ksh_shvrChistory-b_2006-07-24
ksh_shvrChistory-b_2006-02-14
ksh_shvrChistory-b_2005-09-16
ksh_shvrChistory-b_2005-06-01
ksh_shvrChistory-b_2005-02-02
ksh_shvrChistory-b_2004-10-11
alganet marked this conversation as resolved.
Show resolved Hide resolved
@
}

Expand Down
8 changes: 8 additions & 0 deletions variants/loksh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
# Copyright (c) Alexandre Gomes Gaigalas <[email protected]>
# SPDX-License-Identifier: ISC

shvr_current_loksh ()
{
cat <<-@
loksh_7.5
loksh_7.4
@
}

shvr_targets_loksh ()
{
cat <<-@
Expand Down
8 changes: 8 additions & 0 deletions variants/mksh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
# Copyright (c) Alexandre Gomes Gaigalas <[email protected]>
# SPDX-License-Identifier: ISC

shvr_current_mksh ()
{
cat <<-@
mksh_R59c
mksh_R58
@
}

shvr_targets_mksh ()
{
cat <<-@
Expand Down
53 changes: 0 additions & 53 deletions variants/mrsh.sh

This file was deleted.

8 changes: 8 additions & 0 deletions variants/oksh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
# Copyright (c) Alexandre Gomes Gaigalas <[email protected]>
# SPDX-License-Identifier: ISC

shvr_current_oksh ()
{
cat <<-@
oksh_7.5
oksh_7.4
@
}

shvr_targets_oksh ()
{
cat <<-@
Expand Down
8 changes: 8 additions & 0 deletions variants/osh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
# Copyright (c) Alexandre Gomes Gaigalas <[email protected]>
# SPDX-License-Identifier: ISC

shvr_current_osh ()
{
cat <<-@
osh_0.22.0
osh_0.21.0
alganet marked this conversation as resolved.
Show resolved Hide resolved
@
}

shvr_targets_osh ()
{
cat <<-@
Expand Down
8 changes: 8 additions & 0 deletions variants/posh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
# Copyright (c) Alexandre Gomes Gaigalas <[email protected]>
# SPDX-License-Identifier: ISC

shvr_current_posh ()
{
cat <<-@
posh_0.14.1
posh_0.13.2
@
}

shvr_targets_posh ()
{
cat <<-@
Expand Down
Loading
Loading