Skip to content

Commit a44d561

Browse files
committed
chore(git): initial commit
0 parents  commit a44d561

File tree

4 files changed

+162
-0
lines changed

4 files changed

+162
-0
lines changed

.travis.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Developer:
2+
# ---------
3+
# Name: Maik Ellerbrock
4+
# GitHub: https://github.com/ellerbrock
5+
# Twitter: https://twitter.com/frapsoft
6+
# Docker: https://hub.docker.com/u/ellerbrock
7+
# Quay: https://quay.io/user/ellerbrock
8+
#
9+
# Description:
10+
# -----------
11+
# Travis Test for our Docker Container
12+
# - check if the docker build works
13+
# - run certain tests with bats
14+
15+
language: bash
16+
17+
sudo: required
18+
19+
services:
20+
- docker
21+
22+
before_install:
23+
- docker build --force-rm --no-cache -t ellerbrock/bash-it .
24+
- sudo add-apt-repository ppa:duggan/bats --yes
25+
- sudo apt-get update -qq
26+
- sudo apt-get install -qq bats
27+
28+
script:
29+
- bats test/bash-it.bats
30+

Dockerfile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Developer:
2+
# ---------
3+
# Name: Maik Ellerbrock
4+
#
5+
# GitHub: https://github.com/ellerbrock
6+
# Twitter: https://twitter.com/frapsoft
7+
# Docker: https://hub.docker.com/u/ellerbrock
8+
# Quay: https://quay.io/user/ellerbrock
9+
#
10+
# Description:
11+
# -----------
12+
# Bash Shell v.4.4 with bash-it, bats, bash-completion
13+
14+
FROM bash:4.4
15+
16+
ENV VERSION 0.0.1
17+
18+
RUN \
19+
apk add --no-cache \
20+
bash-completion \
21+
git && \
22+
git clone --depth 1 https://github.com/Bash-it/bash-it.git /root/.bash_it && \
23+
/root/.bash_it/install.sh --silent && \
24+
rm -rf /root/.bash_it/.git && \
25+
git clone --depth 1 https://github.com/sstephenson/bats.git /tmp/bats && \
26+
/tmp/bats/install.sh /usr/local && \
27+
echo -e "\n\n# Load bash-completion\n" >> /root/.bashrc && \
28+
echo "[ -f /usr/share/bash-completion/bash_completion ] && source /usr/share/bash-completion/bash_completion" \
29+
>> /root/.bashrc && \
30+
sed -i -e "s/bin\/ash/bin\/bash/" /etc/passwd # && \
31+
apk del git
32+
33+
WORKDIR /root
34+
35+
ENTRYPOINT [ "bash" ]
36+

readme.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
![docker](https://github.frapsoft.com/bashit/Bash-it_400px_transparent.png)
2+
3+
# bash-it-docker
4+
5+
_Bash Shell v.4.4 with bash-it, bats and bash-completion based on Alpine Linux_
6+
7+
[![Docker Automated Build](https://img.shields.io/docker/automated/ellerbrock/bash-it.svg)](https://hub.docker.com/r/ellerbrock/bash-it/) [![Docker Pulls](https://img.shields.io/docker/pulls/ellerbrock/bash-it.svg)](https://hub.docker.com/r/ellerbrock/bash-it/) [![Quay Status](https://quay.io/repository/ellerbrock/bash-it/status)](https://quay.io/repository/ellerbrock/bash-it) [![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg)](https://github.com/ellerbrock/open-source-badges/) [![Gitter Chat](https://badges.gitter.im/frapsoft/frapsoft.svg)](https://gitter.im/frapsoft/frapsoft/)
8+
9+
- Docker: [bash-it](https://hub.docker.com/r/ellerbrock/bash-it/)
10+
- Quay: [bash-it](https://quay.io/repository/ellerbrock/bash-it/)
11+
12+
## Info
13+
14+
_Consider this Repository as Work in Progress._.
15+
16+
You can find Documentation how to use and setup Bash-it in the [Main Repository](https://github.com/Bash-it/bash-it).
17+
Please open only issues related to Docker in this Repository.
18+
19+
## Installation
20+
21+
`docker pull ellerbrock/bash-it`
22+
23+
## Example Usage
24+
25+
**Start a interactive Bash Shell (default)**
26+
27+
`docker run -it ellerbrock/bash-it`
28+
29+
**Use your local `~/.bashrc` settings inside the Container (:ro for read only)**
30+
31+
`docker run -it -v ~/.bashrc:/root/.bashrc:ro ellerbrock/bash-it`
32+
33+
**Map the current directory inside the Container**
34+
35+
`docker run -it ${PWD}:/data ellerbrock/bash-it`
36+
37+
**Map a [Docker Volume](https://docs.docker.com/engine/tutorials/dockervolumes/)**
38+
39+
`docker run -it myVolName:/app ellerbrock/bash-it`
40+
41+
**Copy Data between Volumes**
42+
43+
```
44+
docker run -it \
45+
-v import:/import \
46+
-v export:/export \
47+
ellerbrock/bash-it -c "cp -R /import/* /export"
48+
```
49+
50+
**Backup a Volume to Disk**
51+
52+
```
53+
docker run -it \
54+
-v import:/import \
55+
-v ${PWD}:/export \
56+
ellerbrock/bash-it -c "tar -cvjf /export/backup.tar.bz2 /import/"
57+
```
58+
59+
**Run a Command**
60+
61+
`docker run -it ellerbrock/bash-it -c "ls -alF /"`

test/bash-it.bats

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bats
2+
3+
# Developer:
4+
# ---------
5+
# Name: Maik Ellerbrock
6+
#
7+
# GitHub: https://github.com/ellerbrock
8+
# Twitter: https://twitter.com/frapsoft
9+
# Docker: https://hub.docker.com/u/ellerbrock
10+
# Quay: https://quay.io/user/ellerbrock
11+
#
12+
# Description:
13+
# -----------
14+
# Simple test with bats
15+
16+
@test "check if we can execute bash inside the container" {
17+
run docker run -it ellerbrock/bash-it --help
18+
[ "$status" -eq 0 ]
19+
}
20+
21+
@test "check if bats is available" {
22+
run docker run -it ellerbrock/bash-it -c "[[ $(which bats) ]]"
23+
[ "$status" -eq 0 ]
24+
}
25+
26+
@test "check if the bash-it folder exists" {
27+
run docker run -it ellerbrock/bash-it -c "[[ -d /root/.bash_it ]]"
28+
[ "$status" -eq 0 ]
29+
}
30+
31+
@test "check if the bash-completion folder exists" {
32+
run docker run -it ellerbrock/bash-it -c "[[ -d /usr/share/bash-completion ]]"
33+
[ "$status" -eq 0 ]
34+
}
35+

0 commit comments

Comments
 (0)