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

Make Docker container more accessible for end users who don't want to install a package or git clone #150

Open
espoelstra opened this issue Sep 25, 2018 · 1 comment
Labels
Component: Docker Priority: Medium Wrong or misleading documentation, broken behavior with workaround Type: Enhancement Waiting for Contributor Feedback The original contributor did not yet respond to the latest request

Comments

@espoelstra
Copy link

Requirements:

  • Docker installed

If you paste the script below into a file named bats and make it executable and put it into a folder on the PATH chmod +x bats && mkdir -p ~/.local/bin && cp bats ~/.local/bin/bats && . /etc/profile (the last bit puts ~/.local/bin on your PATH for you in Ubuntu (and maybe Debian) or you can chmod a+x bats && sudo cp bats /usr/local/bin/bats to share it across all users, and now you can find bats with which bats, but when the script runs it will pull the Docker container at the version you specify in the script in place of latest, ie to pin a certain release for consistent testing with known features, or since it doesn't change often or wildly change the API you can just use latest and run your tests regularly to detect if it fails when something changes upstream.

#!/bin/bash
set -Eeu -o pipefail

# If no arguments were provided we'll guess you just want to run bats tests from the `test` directory
[ $# -gt 0 ] && options_and_path="$@" || options_and_path="test"
docker run --rm -i -t \
		--name df-bats \
		-v $(pwd):/opt/bats \
		--workdir /opt/bats \
                --entrypoint bats \
		bats/bats:latest $options_and_path

I modified the Dockerfile quite a bit from what is included in the repository, but the end result is much the same. I'll add that tomorrow as I explore a bit more with adding some of the helper libraries on an optional basis to the base image or by providing volume mounts where they can be mapped in and seamlessly interact with bats in the container.

@martin-schulze-vireso martin-schulze-vireso added Component: Docker Priority: Medium Wrong or misleading documentation, broken behavior with workaround Type: Enhancement labels Oct 24, 2021
@martin-schulze-vireso
Copy link
Member

Die you still plan to created a PR? While I see some merit, the path changes might be confusing.

@martin-schulze-vireso martin-schulze-vireso added the Waiting for Contributor Feedback The original contributor did not yet respond to the latest request label Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Docker Priority: Medium Wrong or misleading documentation, broken behavior with workaround Type: Enhancement Waiting for Contributor Feedback The original contributor did not yet respond to the latest request
Projects
None yet
Development

No branches or pull requests

2 participants