Change git hooks directory and add README
This commit is contained in:
parent
ddece179e0
commit
3c9b88e7df
|
|
@ -0,0 +1,5 @@
|
||||||
|
# docker-ruby
|
||||||
|
|
||||||
|
This repository provides Dockerfiles for Alpine and CentOS based images with Ruby. Dockerfiles are generated with pre-commit git hook (`./git-hooks/pre-commit`) and corresponding template in the project's root, so one needs to run `git config core.hooksPath git-hooks` first in order to use it.
|
||||||
|
|
||||||
|
Alpine template is based on official [docker-library/ruby](https://github.com/docker-library/ruby).
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Script is used to generate all the necessary Dockerfiles based on the templates
|
||||||
|
|
||||||
|
declare -a ruby_versions=("2.5.3" "2.6.2" "2.6.3" "2.6.5")
|
||||||
|
declare -a distributions=("alpine:3.12" "centos:7")
|
||||||
|
|
||||||
|
for i in "${distributions[@]}"
|
||||||
|
do
|
||||||
|
DISTRO_NAME="$(cut -d ':' -f1 <<< $i)"
|
||||||
|
DISTRO_VERSION="$(cut -d ':' -f2 <<< $i)"
|
||||||
|
|
||||||
|
for j in "${ruby_versions[@]}"
|
||||||
|
do
|
||||||
|
# E.g. ./alpine/3.11/2.5.3
|
||||||
|
TARGET_DIR="./generated/$DISTRO_NAME/$DISTRO_VERSION/$j"
|
||||||
|
RUBY_MAJOR="$(echo $j | grep --only-matching -E '[[:digit:]]+\.[[:digit:]]+')"
|
||||||
|
|
||||||
|
mkdir --parents $TARGET_DIR
|
||||||
|
cp ./Dockerfile.$DISTRO_NAME.template $TARGET_DIR/Dockerfile
|
||||||
|
|
||||||
|
sed -i "s/{RUBY_VERSION}/$j/g" $TARGET_DIR/Dockerfile
|
||||||
|
sed -i "s/{RUBY_MAJOR}/$RUBY_MAJOR/g" $TARGET_DIR/Dockerfile
|
||||||
|
sed -i "s/{DISTRO_VERSION}/$DISTRO_VERSION/g" $TARGET_DIR/Dockerfile
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
git add ./generated
|
||||||
Loading…
Reference in New Issue