Skip to content
Open
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
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

FROM quay.io/flozanorht/flamel:0.3-7 as pre-commit
FROM quay.io/redhattraining/flamel as pre-commit

RUN curl https://pre-commit.com/install-local.py | python - & \
ln -s /root/bin/pre-commit /usr/bin/pre-commit & \
dnf install -y perl ruby
dnf install -y perl ruby rubygems

FROM pre-commit

Expand Down
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
Docker image for running GLS pre-commit hooks.
# Pre commit image

Usage:
Just run "pre-commit.sh" or alias it to "pre-commit" in your system.
Docker image for running GLS pre-commit hooks. You can just run "pre-commit.sh", symlink or alias it to "pre-commit" in your system.

If your SSH configuration or your pre-commit cache is not in the default locations, update the appropriate variables in the "pre-commit.sh" script file as needed.
### Installation

Clone this repository:

```sh

git clone git@github.com:jramcast/pre-commit-image.git
```

Go to `/usr/bin` or any other folder in your PATH and create a symlink to `pre-commit.sh`.
Change REPO_CLONE_PATH with the actual directory where you cloned the repo:

```sh
ln -s REPO_CLONE_PATH/pre-commit.sh pre-commit-docker
````

If your SSH configuration or your pre-commit cache is not in the default locations, update the appropriate variables in the "pre-commit.sh" script file as needed.

To run the script, go to any course root directory and execute `pre-commit-docker`:

```
cd $COURSE_DIR
pre-commit-docker
```
12 changes: 9 additions & 3 deletions pre-commit.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
#! /bin/sh

image=quay.io/someth2say/pre-commit:0.1.0
image=pre-commit-docker

book=$(pwd)
container_book=/tmp/coursebook

this_file=$(python -c "import os; print(os.path.realpath('$BASH_SOURCE'))")
this_dir=$( cd -P "$( dirname $this_file )" && pwd )

ssh_cfg=~/.ssh
container_ssh_cfg=/root/.ssh

pcommit_cache=~/.cache/pre-commit
containe_pcommit_cache=/root/.cache/pre-commit
container_pcommit_cache=/root/.cache/pre-commit

# Force image rebuild to always grab the latest flamel version
docker build -t $image $this_dir

docker run \
-v ${ssh_cfg}:${container_ssh_cfg} \
-v ${pcommit_cache}:${containe_pcommit_cache}:z \
-v ${pcommit_cache}:${container_pcommit_cache}:z \
-v ${book}:${container_book}:z \
${image} $@