Commit 036fad9603a873f4b7b620f717407a472ba7ed28

Authored by João Vitor Rebouças
1 parent a39ce97f
Exists in master

Adicionando Dockerfiles dos artefatos comuns e intermediários

commons/centos/7.2/Dockerfile 0 → 100644
... ... @@ -0,0 +1,16 @@
  1 +FROM centos:7.2.1511
  2 +
  3 +MAINTAINER CAPGov-INFRA
  4 +
  5 +LABEL name="CentOS 7.2.1511" \
  6 + description="Imagem do CentOS 7.2.1511 com timezone definido para São Paulo" \
  7 + dockerfiles-version="1.0.0" \
  8 + vendor="CAPGov-INFRA <capgov@cos.ufrj.br>"
  9 +
  10 +ARG timezone="America/Sao_Paulo"
  11 +
  12 +ENV TZ=$timezone
  13 +
  14 +RUN rm -f /etc/localtime && \
  15 + ln -s /usr/share/zoneinfo/${TZ} /etc/localtime && \
  16 + yum update -y && yum autoremove -y && yum clean all
... ...
commons/centos/7/Dockerfile 0 → 100644
... ... @@ -0,0 +1,16 @@
  1 +FROM centos:7
  2 +
  3 +MAINTAINER CAPGov-INFRA
  4 +
  5 +LABEL name="CentOS 7" \
  6 + description="Imagem do CentOS 7 com timezone definido para São Paulo" \
  7 + dockerfile-version="1.0.0" \
  8 + vendor="CAPGov-INFRA <capgov@cos.ufrj.br>"
  9 +
  10 +ARG timezone="America/Sao_Paulo"
  11 +
  12 +ENV TZ=$timezone
  13 +
  14 +RUN rm -f /etc/localtime && \
  15 + ln -s /usr/share/zoneinfo/${TZ} /etc/localtime && \
  16 + yum update -y && yum autoremove -y && yum clean all
... ...
commons/centos/latest/Dockerfile 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +FROM centos:7
  2 +
  3 +MAINTAINER CAPGov-INFRA
  4 +
  5 +LABEL name="CentOS 7" \
  6 + description="Imagem do CentOS 7 com timezone definido para São Paulo" \
  7 + dockerfile-version="1.0.0" \
  8 + vendor="CAPGov-INFRA <capgov@cos.ufrj.br>"
  9 +
  10 +ARG timezone="America/Sao_Paulo"
  11 +
  12 +ENV TZ=$timezone
  13 +
  14 +RUN rm -f /etc/localtime && \
  15 + ln -s /usr/share/zoneinfo/${TZ} /etc/localtime && \
  16 + yum update -y && yum autoremove -y && yum clean all
  17 +
... ...
commons/mongodb/latest/Dockerfile 0 → 100644
... ... @@ -0,0 +1,35 @@
  1 +FROM capgov/centos:latest
  2 +
  3 +MAINTAINER CAPGov-INFRA
  4 +
  5 +LABEL name="Java com R" \
  6 + description="Imagem do Java com R" \
  7 + dockerfile-version="1.0.0" \
  8 + vendor="CAPGov-INFRA <capgov@cos.ufrj.br>"
  9 +
  10 +SHELL ["/bin/bash", "-c"]
  11 +
  12 +COPY ./FILES/mongodb-entrypoint.sh /
  13 +
  14 +RUN groupadd -r -g 5000 mongodb && \
  15 + useradd -Mr -c "MongoDB User" -g 5000 -u 5000 mongodb && \
  16 + echo -e '[mongodb-org-3.4]\nname=MongoDB Repository\nbaseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.4/x86_64/\ngpgcheck=1\nenabled=1\ngpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc' > /etc/yum.repos.d/mongodb-org-3.4.repo && \
  17 + yum update -y && \
  18 + yum install -y mongodb-org && \
  19 + yum clean all && \
  20 + mkdir -p /var/lib/mongodb/{db,configdb} /var/run/mongodb && \
  21 + sed -i 's|dbPath: /var/lib/mongo|dbPath: /var/lib/mongodb|g' /etc/mongod.conf && \
  22 + sed -i 's|fork: true|fork: false|g' /etc/mongod.conf && \
  23 + sed -i 's| bindIp: 127.0.0.1|# bindIp: 127.0.0.1|g' /etc/mongod.conf && \
  24 + sed -i 's|systemLog:|#systemLog:|g' /etc/mongod.conf && \
  25 + sed -i 's| destination: file|# destination: file|g' /etc/mongod.conf && \
  26 + sed -i 's| logAppend: true|# logAppend: true|g' /etc/mongod.conf && \
  27 + sed -i 's| path: /var/log/mongodb/mongod.log|# path: /var/log/mongodb/mongod.log|g' /etc/mongod.conf && \
  28 + chmod +x /mongodb-entrypoint.sh && \
  29 + chown mongodb:mongodb -R /var/lib/mongodb /var/log/mongodb /var/run/mongodb /mongodb-entrypoint.sh
  30 +
  31 +EXPOSE 27017
  32 +
  33 +USER mongodb
  34 +
  35 +ENTRYPOINT ["/mongodb-entrypoint.sh"]
... ...
commons/mongodb/latest/FILES/mongodb-entrypoint.sh 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +#!/bin/bash
  2 +
  3 +exec /usr/bin/mongod --config /etc/mongod.conf | tee /var/log/mongodb/mongod.log
... ...
commons/mysql/5.5/Dockerfile 0 → 100644
... ... @@ -0,0 +1,30 @@
  1 +FROM capgov/centos:latest
  2 +MAINTAINER CAPGov-Infra
  3 +
  4 +COPY FILES/docker-entrypoint.sh /
  5 +
  6 +ENV MYSQL_CONFIG_FILE /usr/my.cnf
  7 +
  8 +RUN groupadd --system --gid 5000 mysql && \
  9 + useradd --create-home --system --home-dir "/home/mysql" --comment "MySQL User" --gid 5000 --uid 5000 mysql && \
  10 + rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm && \
  11 + yum update -y && \
  12 + yum-config-manager --disable mysql57-community && \
  13 + yum-config-manager --enable mysql56-community && \
  14 + yum install -y install mysql-community-server && \
  15 + yum clean all && \
  16 + touch $MYSQL_CONFIG_FILE && \
  17 + chmod 740 /docker-entrypoint.sh && \
  18 + chown mysql. /docker-entrypoint.sh $MYSQL_CONFIG_FILE && \
  19 + mkdir -p /docker-entrypoint-initdb.d && \
  20 + chown -R mysql: /docker-entrypoint-initdb.d
  21 +
  22 +EXPOSE 3306
  23 +
  24 +USER mysql
  25 +
  26 +WORKDIR /var/lib/mysql
  27 +
  28 +VOLUME ["/var/lib/mysql"]
  29 +
  30 +ENTRYPOINT ["/docker-entrypoint.sh"]
... ...
commons/mysql/5.5/FILES/MySQL-server-5.5.55-1.el7.x86_64.rpm 0 → 100644
No preview for this file type
commons/mysql/5.5/FILES/docker-entrypoint.sh 0 → 100644
... ... @@ -0,0 +1,102 @@
  1 +#!/bin/bash
  2 +
  3 +MYSQL_DATA='/var/lib/mysql'
  4 +MYSQL_FILE_BEGIN="$MYSQL_DATA/MYSQL_BEGIN"
  5 +
  6 +function VerifyCredintials {
  7 + local USER=$1
  8 + local PASSWORD=$2
  9 + local DATABASE=$3
  10 +
  11 + if [ -z "$USER" ] || [ -z "$PASSWORD" ]; then
  12 + echo "ERROR: MYSQL_USER and MYSQL_PASSWORD cannot be empty." > /dev/stderr
  13 + exit -1
  14 + fi
  15 +
  16 + if [ "$USER" = "root" ]; then
  17 + echo "ERROR: MYSQL_USER cannot be the root account." > /dev/stderr
  18 + exit -1
  19 + fi
  20 +
  21 + if [ -z "$DATABASE" ]; then
  22 + MYSQL_DATABASE="$USER"
  23 + fi
  24 +}
  25 +
  26 +function CreateInitialDatabase {
  27 + local DATADIR=$1
  28 +
  29 + mysql_install_db --datadir="$DATADIR" --user='mysql'
  30 +
  31 + if [ $? -ne 0 ]; then
  32 + echo "ERROR: Could not create an initial database." > /dev/stderr
  33 + exit -1
  34 + fi
  35 +}
  36 +
  37 +function CreateSuperuser {
  38 + local USER=$1
  39 + local PASSWORD=$2
  40 +
  41 + mysql -u root --protocol=socket --wait -e "CREATE USER '$USER' IDENTIFIED BY '$PASSWORD';"
  42 + mysql -u root --protocol=socket --wait -e "GRANT ALL PRIVILEGES ON $MYSQL_DATABASE.* TO '$USER';"
  43 + mysql -u root --protocol=socket --wait -e "FLUSH PRIVILEGES;"
  44 +}
  45 +
  46 +function CreateDatabase {
  47 + local DATABASE=$1
  48 +
  49 + mysql -u root --protocol=socket --wait -e "CREATE DATABASE IF NOT EXISTS $DATABASE;"
  50 +}
  51 +
  52 +function CreateFileBegin {
  53 + local FILE=$1
  54 +
  55 + date +%c > $FILE
  56 +}
  57 +
  58 +function StartDatabaseServer {
  59 + mysqld $@
  60 +}
  61 +
  62 +function StartDatabaseServerBackground {
  63 + mysqld &
  64 + sleep 5
  65 +}
  66 +
  67 +function StopDatabaseServer {
  68 + mysqladmin -u root shutdown
  69 + sleep 5
  70 +}
  71 +
  72 +function RestoreDatabase {
  73 +
  74 + mysqladmin -u root refresh
  75 +
  76 + for file in `ls /docker-entrypoint-initdb.d/*`; do
  77 + case $file in
  78 + *.sh )
  79 + echo "Running '$file'..."
  80 + . $file ;;
  81 + esac
  82 + done
  83 +
  84 +}
  85 +
  86 +function Main {
  87 +
  88 + if [ ! -f $MYSQL_FILE_BEGIN ]; then
  89 + VerifyCredintials $MYSQL_USER $MYSQL_PASSWORD $MYSQL_DATABASE
  90 + CreateInitialDatabase $MYSQL_DATA
  91 + StartDatabaseServerBackground
  92 + CreateDatabase $MYSQL_DATABASE
  93 + CreateSuperuser $MYSQL_USER $MYSQL_PASSWORD
  94 + RestoreDatabase
  95 + StopDatabaseServer
  96 + CreateFileBegin $MYSQL_FILE_BEGIN
  97 + fi
  98 +
  99 + StartDatabaseServer $@
  100 +}
  101 +
  102 +Main $@
... ...
commons/mysql/5.6.30/Dockerfile 0 → 100644
... ... @@ -0,0 +1,39 @@
  1 +FROM capgov/centos:latest
  2 +
  3 +MAINTAINER CAPGov-Infra
  4 +
  5 +LABEL name="MySQL 5.6.30" \
  6 + description="Imagem do MySQL 5.6.30" \
  7 + dockerfile-version="1.0.0" \
  8 + vendor="CAPGov-INFRA <capgov@cos.ufrj.br>"
  9 +
  10 +COPY FILES/docker-entrypoint.sh /
  11 +
  12 +ENV MYSQL_CONFIG_FILE /usr/my.cnf
  13 +
  14 +COPY ./FILES/mysql-community-server-5.6.30-2.el7.x86_64.rpm /tmp
  15 +COPY ./FILES/mysql-community-common-5.6.30-2.el7.x86_64.rpm /tmp
  16 +COPY ./FILES/mysql-community-client-5.6.30-2.el7.x86_64.rpm /tmp
  17 +COPY ./FILES/mysql-community-libs-5.6.30-2.el7.x86_64.rpm /tmp
  18 +
  19 +RUN groupadd --system --gid 5000 mysql && \
  20 + useradd --create-home --system --home-dir "/home/mysql" --comment "MySQL User" --gid 5000 --uid 5000 mysql && \
  21 + yum install -y /tmp/mysql-community-server-5.6.30-2.el7.x86_64.rpm /tmp/mysql-community-common-5.6.30-2.el7.x86_64.rpm /tmp/mysql-community-client-5.6.30-2.el7.x86_64.rpm /tmp/mysql-community-libs-5.6.30-2.el7.x86_64.rpm && \
  22 + yum update -y && \
  23 + yum clean all && \
  24 + rm -f /tmp/*.rpm && \
  25 + touch $MYSQL_CONFIG_FILE && \
  26 + chmod 740 /docker-entrypoint.sh && \
  27 + chown mysql. /docker-entrypoint.sh $MYSQL_CONFIG_FILE && \
  28 + mkdir -p /docker-entrypoint-initdb.d && \
  29 + chown -R mysql: /docker-entrypoint-initdb.d
  30 +
  31 +EXPOSE 3306
  32 +
  33 +USER mysql
  34 +
  35 +WORKDIR /var/lib/mysql
  36 +
  37 +VOLUME ["/var/lib/mysql"]
  38 +
  39 +ENTRYPOINT ["/docker-entrypoint.sh"]
... ...
commons/mysql/5.6.30/FILES/docker-entrypoint.sh 0 → 100644
... ... @@ -0,0 +1,102 @@
  1 +#!/bin/bash
  2 +
  3 +MYSQL_DATA='/var/lib/mysql'
  4 +MYSQL_FILE_BEGIN="$MYSQL_DATA/MYSQL_BEGIN"
  5 +
  6 +function VerifyCredintials {
  7 + local USER=$1
  8 + local PASSWORD=$2
  9 + local DATABASE=$3
  10 +
  11 + if [ -z "$USER" ] || [ -z "$PASSWORD" ]; then
  12 + echo "ERROR: MYSQL_USER and MYSQL_PASSWORD cannot be empty." > /dev/stderr
  13 + exit -1
  14 + fi
  15 +
  16 + if [ "$USER" = "root" ]; then
  17 + echo "ERROR: MYSQL_USER cannot be the root account." > /dev/stderr
  18 + exit -1
  19 + fi
  20 +
  21 + if [ -z "$DATABASE" ]; then
  22 + MYSQL_DATABASE="$USER"
  23 + fi
  24 +}
  25 +
  26 +function CreateInitialDatabase {
  27 + local DATADIR=$1
  28 +
  29 + mysql_install_db --datadir="$DATADIR" --user='mysql'
  30 +
  31 + if [ $? -ne 0 ]; then
  32 + echo "ERROR: Could not create an initial database." > /dev/stderr
  33 + exit -1
  34 + fi
  35 +}
  36 +
  37 +function CreateSuperuser {
  38 + local USER=$1
  39 + local PASSWORD=$2
  40 +
  41 + mysql -u root --protocol=socket --wait -e "CREATE USER '$USER' IDENTIFIED BY '$PASSWORD';"
  42 + mysql -u root --protocol=socket --wait -e "GRANT ALL PRIVILEGES ON $MYSQL_DATABASE.* TO '$USER';"
  43 + mysql -u root --protocol=socket --wait -e "FLUSH PRIVILEGES;"
  44 +}
  45 +
  46 +function CreateDatabase {
  47 + local DATABASE=$1
  48 +
  49 + mysql -u root --protocol=socket --wait -e "CREATE DATABASE IF NOT EXISTS $DATABASE;"
  50 +}
  51 +
  52 +function CreateFileBegin {
  53 + local FILE=$1
  54 +
  55 + date +%c > $FILE
  56 +}
  57 +
  58 +function StartDatabaseServer {
  59 + mysqld $@
  60 +}
  61 +
  62 +function StartDatabaseServerBackground {
  63 + mysqld &
  64 + sleep 5
  65 +}
  66 +
  67 +function StopDatabaseServer {
  68 + mysqladmin -u root shutdown
  69 + sleep 5
  70 +}
  71 +
  72 +function RestoreDatabase {
  73 +
  74 + mysqladmin -u root refresh
  75 +
  76 + for file in `ls /docker-entrypoint-initdb.d/*`; do
  77 + case $file in
  78 + *.sh )
  79 + echo "Running '$file'..."
  80 + . $file ;;
  81 + esac
  82 + done
  83 +
  84 +}
  85 +
  86 +function Main {
  87 +
  88 + if [ ! -f $MYSQL_FILE_BEGIN ]; then
  89 + VerifyCredintials $MYSQL_USER $MYSQL_PASSWORD $MYSQL_DATABASE
  90 + CreateInitialDatabase $MYSQL_DATA
  91 + StartDatabaseServerBackground
  92 + CreateDatabase $MYSQL_DATABASE
  93 + CreateSuperuser $MYSQL_USER $MYSQL_PASSWORD
  94 + RestoreDatabase
  95 + StopDatabaseServer
  96 + CreateFileBegin $MYSQL_FILE_BEGIN
  97 + fi
  98 +
  99 + StartDatabaseServer $@
  100 +}
  101 +
  102 +Main $@
... ...
commons/mysql/5.6.30/FILES/mysql-community-5.6.30-2.el7.src.rpm 0 → 100644
No preview for this file type
commons/mysql/5.6.30/FILES/mysql-community-client-5.6.30-2.el7.x86_64.rpm 0 → 100644
No preview for this file type
commons/mysql/5.6.30/FILES/mysql-community-common-5.6.30-2.el7.x86_64.rpm 0 → 100644
No preview for this file type
commons/mysql/5.6.30/FILES/mysql-community-embedded-5.6.30-2.el7.x86_64.rpm 0 → 100644
No preview for this file type
commons/mysql/5.6.30/FILES/mysql-community-libs-5.6.30-2.el7.x86_64.rpm 0 → 100644
No preview for this file type
commons/mysql/5.6.30/FILES/mysql-community-server-5.6.30-2.el7.x86_64.rpm 0 → 100644
No preview for this file type
commons/mysql/5.6.30/FILES/mysql-community-server-minimal-5.6.30-2.el7.x86_64.rpm 0 → 100644
No preview for this file type
commons/mysql/5.6/Dockerfile 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +FROM capgov/centos:latest
  2 +
  3 +MAINTAINER CAPGov-Infra
  4 +
  5 +LABEL name="MySQL 5.6" \
  6 + description="Imagem do MySQL 5.6" \
  7 + dockerfile-version="1.0.0" \
  8 + vendor="CAPGov-INFRA <capgov@cos.ufrj.br>"
  9 +
  10 +COPY FILES/docker-entrypoint.sh /
  11 +
  12 +ENV MYSQL_CONFIG_FILE /usr/my.cnf
  13 +
  14 +RUN groupadd --system --gid 5000 mysql && \
  15 + useradd --create-home --system --home-dir "/home/mysql" --comment "MySQL User" --gid 5000 --uid 5000 mysql && \
  16 + rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm && \
  17 + yum update -y && \
  18 + yum-config-manager --disable mysql57-community && \
  19 + yum-config-manager --enable mysql56-community && \
  20 + yum install -y install mysql-community-server && \
  21 + yum clean all && \
  22 + touch $MYSQL_CONFIG_FILE && \
  23 + chmod 740 /docker-entrypoint.sh && \
  24 + chown mysql. /docker-entrypoint.sh $MYSQL_CONFIG_FILE && \
  25 + mkdir -p /docker-entrypoint-initdb.d && \
  26 + chown -R mysql: /docker-entrypoint-initdb.d
  27 +
  28 +EXPOSE 3306
  29 +
  30 +USER mysql
  31 +
  32 +WORKDIR /var/lib/mysql
  33 +
  34 +VOLUME ["/var/lib/mysql"]
  35 +
  36 +ENTRYPOINT ["/docker-entrypoint.sh"]
... ...
commons/mysql/5.6/FILES/docker-entrypoint.sh 0 → 100644
... ... @@ -0,0 +1,102 @@
  1 +#!/bin/bash
  2 +
  3 +MYSQL_DATA='/var/lib/mysql'
  4 +MYSQL_FILE_BEGIN="$MYSQL_DATA/MYSQL_BEGIN"
  5 +
  6 +function VerifyCredintials {
  7 + local USER=$1
  8 + local PASSWORD=$2
  9 + local DATABASE=$3
  10 +
  11 + if [ -z "$USER" ] || [ -z "$PASSWORD" ]; then
  12 + echo "ERROR: MYSQL_USER and MYSQL_PASSWORD cannot be empty." > /dev/stderr
  13 + exit -1
  14 + fi
  15 +
  16 + if [ "$USER" = "root" ]; then
  17 + echo "ERROR: MYSQL_USER cannot be the root account." > /dev/stderr
  18 + exit -1
  19 + fi
  20 +
  21 + if [ -z "$DATABASE" ]; then
  22 + MYSQL_DATABASE="$USER"
  23 + fi
  24 +}
  25 +
  26 +function CreateInitialDatabase {
  27 + local DATADIR=$1
  28 +
  29 + mysql_install_db --datadir="$DATADIR" --user='mysql'
  30 +
  31 + if [ $? -ne 0 ]; then
  32 + echo "ERROR: Could not create an initial database." > /dev/stderr
  33 + exit -1
  34 + fi
  35 +}
  36 +
  37 +function CreateSuperuser {
  38 + local USER=$1
  39 + local PASSWORD=$2
  40 +
  41 + mysql -u root --protocol=socket --wait -e "CREATE USER '$USER' IDENTIFIED BY '$PASSWORD';"
  42 + mysql -u root --protocol=socket --wait -e "GRANT ALL PRIVILEGES ON $MYSQL_DATABASE.* TO '$USER';"
  43 + mysql -u root --protocol=socket --wait -e "FLUSH PRIVILEGES;"
  44 +}
  45 +
  46 +function CreateDatabase {
  47 + local DATABASE=$1
  48 +
  49 + mysql -u root --protocol=socket --wait -e "CREATE DATABASE IF NOT EXISTS $DATABASE;"
  50 +}
  51 +
  52 +function CreateFileBegin {
  53 + local FILE=$1
  54 +
  55 + date +%c > $FILE
  56 +}
  57 +
  58 +function StartDatabaseServer {
  59 + exec mysqld $@
  60 +}
  61 +
  62 +function StartDatabaseServerBackground {
  63 + mysqld &
  64 + sleep 5
  65 +}
  66 +
  67 +function StopDatabaseServer {
  68 + mysqladmin -u root shutdown
  69 + sleep 5
  70 +}
  71 +
  72 +function RestoreDatabase {
  73 +
  74 + mysqladmin -u root refresh
  75 +
  76 + for file in `ls /docker-entrypoint-initdb.d/*`; do
  77 + case $file in
  78 + *.sh )
  79 + echo "Running '$file'..."
  80 + . $file ;;
  81 + esac
  82 + done
  83 +
  84 +}
  85 +
  86 +function Main {
  87 +
  88 + if [ ! -f $MYSQL_FILE_BEGIN ]; then
  89 + VerifyCredintials $MYSQL_USER $MYSQL_PASSWORD $MYSQL_DATABASE
  90 + CreateInitialDatabase $MYSQL_DATA
  91 + StartDatabaseServerBackground
  92 + CreateDatabase $MYSQL_DATABASE
  93 + CreateSuperuser $MYSQL_USER $MYSQL_PASSWORD
  94 + RestoreDatabase
  95 + StopDatabaseServer
  96 + CreateFileBegin $MYSQL_FILE_BEGIN
  97 + fi
  98 +
  99 + StartDatabaseServer $@
  100 +}
  101 +
  102 +Main $@
... ...
commons/mysql/5.7/Dockerfile 0 → 100644
... ... @@ -0,0 +1,33 @@
  1 +FROM capgov/centos:latest
  2 +
  3 +MAINTAINER CAPGov-Infra
  4 +
  5 +LABEL name="MySQL 5.7" \
  6 + description="Imagem do MySQL 5.7" \
  7 + dockerfile-version="1.0.0" \
  8 + vendor="CAPGov-INFRA <capgov@cos.ufrj.br>"
  9 +
  10 +COPY ./FILES/docker-entrypoint.sh /
  11 +
  12 +ENV MYSQL_CONFIG_FILE /usr/my.cnf
  13 +
  14 +RUN groupadd -r --gid=5000 mysql && \
  15 + useradd -m -c "MySQL User" -r -g mysql --uid=5000 mysql && \
  16 + yum install -y https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm && \
  17 + yum update -y && \
  18 + yum install -y install mysql-community-server && \
  19 + yum clean all && \
  20 + touch $MYSQL_CONFIG_FILE && \
  21 + chmod 740 /docker-entrypoint.sh && \
  22 + mkdir /docker-entrypoint-initdb.d && \
  23 + chown -R mysql:mysql /docker-entrypoint.sh $MYSQL_CONFIG_FILE /docker-entrypoint-initdb.d
  24 +
  25 +EXPOSE 3306
  26 +
  27 +USER mysql
  28 +
  29 +WORKDIR /var/lib/mysql
  30 +
  31 +VOLUME ["/var/lib/mysql"]
  32 +
  33 +CMD ["bash","/docker-entrypoint.sh"]
... ...
commons/mysql/5.7/FILES/docker-entrypoint.sh 0 → 100755
... ... @@ -0,0 +1,105 @@
  1 +#!/bin/bash
  2 +
  3 +MYSQL_DATA='/var/lib/mysql'
  4 +MYSQL_FILE_BEGIN="$MYSQL_DATA/MYSQL_BEGIN"
  5 +
  6 +function VerifyCredintials {
  7 + local USER=$1
  8 + local PASSWORD=$2
  9 + local DATABASE=$3
  10 +
  11 + if [ -z "$USER" ] || [ -z "$PASSWORD" ]; then
  12 + echo "ERROR: MYSQL_USER and MYSQL_PASSWORD cannot be empty." > /dev/stderr
  13 + exit -1
  14 + fi
  15 +
  16 + if [ "$USER" = "root" ]; then
  17 + echo "ERROR: MYSQL_USER cannot be the root account." > /dev/stderr
  18 + exit -1
  19 + fi
  20 +
  21 + if [ -z "$DATABASE" ]; then
  22 + MYSQL_DATABASE="$USER"
  23 + fi
  24 +}
  25 +
  26 +function CreateInitialDatabase {
  27 + local DATADIR=$1
  28 +
  29 +# mysql_install_db --datadir="$DATADIR" --user='mysql' --insecure --verbose
  30 + mysqld --initialize-insecure --datadir="$DATADIR" --user="mysql"
  31 +
  32 + if [ $? -ne 0 ]; then
  33 + echo "ERROR: Could not create an initial database." > /dev/stderr
  34 + exit -1
  35 + fi
  36 +}
  37 +
  38 +function CreateSuperuser {
  39 + local USER=$1
  40 + local PASSWORD=$2
  41 +
  42 + mysql -u root --protocol=socket --wait -e "CREATE USER '$USER' IDENTIFIED BY '$PASSWORD';"
  43 + mysql -u root --protocol=socket --wait -e "GRANT ALL PRIVILEGES ON $MYSQL_DATABASE.* TO '$USER';"
  44 + mysql -u root --protocol=socket --wait -e "FLUSH PRIVILEGES;"
  45 +}
  46 +
  47 +function CreateDatabase {
  48 + local DATABASE=$1
  49 +
  50 + mysql -u root --protocol=socket --wait -e "CREATE DATABASE IF NOT EXISTS $DATABASE;"
  51 +}
  52 +
  53 +function CreateFileBegin {
  54 + local FILE=$1
  55 +
  56 + date +%c > $FILE
  57 +}
  58 +
  59 +function StartDatabaseServer {
  60 + mysqld $@
  61 +}
  62 +
  63 +function StartDatabaseServerBackground {
  64 + mysqld &
  65 + sleep 5
  66 +}
  67 +
  68 +function StopDatabaseServer {
  69 + mysqladmin -u root shutdown
  70 + sleep 5
  71 +}
  72 +
  73 +function RestoreDatabase {
  74 +
  75 + mysqladmin -u root refresh
  76 +
  77 + for file in `ls /docker-entrypoint-initdb.d/*`; do
  78 + case $file in
  79 + *.sh )
  80 + echo "Running '$file'..."
  81 + . $file ;;
  82 + esac
  83 + done
  84 +
  85 +}
  86 +
  87 +function Main {
  88 +
  89 + if [ ! -f $MYSQL_FILE_BEGIN ]; then
  90 + VerifyCredintials $MYSQL_USER $MYSQL_PASSWORD $MYSQL_DATABASE
  91 + CreateInitialDatabase $MYSQL_DATA
  92 + StartDatabaseServerBackground
  93 + CreateDatabase $MYSQL_DATABASE
  94 + CreateSuperuser $MYSQL_USER $MYSQL_PASSWORD
  95 + RestoreDatabase
  96 + StopDatabaseServer
  97 + CreateFileBegin $MYSQL_FILE_BEGIN
  98 + cat /var/log/mysqld.log
  99 + fi
  100 +
  101 + StartDatabaseServerBackground
  102 + tail -f /var/log/mysqld.log
  103 +}
  104 +
  105 +Main $@
... ...
commons/rabbitmq/3.6.9-1-management/Dockerfile 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +FROM capgov/centos
  2 +
  3 +MAINTAINER CAPGog-INFRA
  4 +
  5 +LABEL name="Rabbitmq 3.6.9-1" \
  6 + description="Imagem do Rabbitmq 3.6.9-1" \
  7 + version="1.0.0"
  8 +
  9 +COPY ./FILES/rabbitmq-server-3.6.9-1.el7.noarch.rpm /opt/
  10 +
  11 +RUN yum install -y epel-release && \
  12 + yum update -y && \
  13 + yum install -y erlang /opt/rabbitmq-server-3.6.9-1.el7.noarch.rpm && \
  14 + mkdir -p /var/lib/rabbitmq /etc/rabbitmq && \
  15 + echo '[ { rabbit, [ { loopback_users, [ ] } ] } ].' > /etc/rabbitmq/rabbitmq.config && \
  16 + rabbitmq-plugins enable --offline rabbitmq_management && \
  17 + chown -R rabbitmq. /var/lib/rabbit* /etc/rabbit*
  18 +
  19 +ENV RABBITMQ_LOGS=- \
  20 + RABBITMQ_SASL_LOGS=-
  21 +
  22 +USER rabbitmq
  23 +
  24 +EXPOSE 15671 15672 4369 5671 5672 25672
  25 +
  26 +VOLUME /var/lib/rabbitmq
  27 +
  28 +CMD ["rabbitmq-server"]
... ...
commons/rabbitmq/3.6.9-1-management/FILES/rabbitmq-server-3.6.9-1.el7.noarch.rpm 0 → 100644
No preview for this file type
commons/redis/3.2.8/Dockerfile 0 → 100644
... ... @@ -0,0 +1,41 @@
  1 +FROM capgov/centos:7
  2 +
  3 +LABEL name="Redis 3.2.8" \
  4 + description="Imagem do redis 3.2.8" \
  5 + version="1.0.0"
  6 +
  7 +ENV redisPrefix=/usr/local \
  8 + redisLocation=/var/lib/redis \
  9 + redisVersion=3.2.8 \
  10 + redisInstallerSHA256="61b373c23d18e6cc752a69d5ab7f676c6216dc2853e46750a8c4ed791d68482c"
  11 +
  12 +ENV REDIS_VERSION=${redisVersion} \
  13 + REDIS_INSTALLER_URL="http://download.redis.io/releases/redis-${redisVersion}.tar.gz" \
  14 + REDIS_INSTALLER_SHA256SUM="61b373c23d18e6cc752a69d5ab7f676c6216dc2853e46750a8c4ed791d68482c"
  15 +
  16 +RUN groupadd --system --gid 5000 redis && \
  17 + useradd -Mr -c "Redis User" --gid 5000 --uid 5000 redis && \
  18 + yum install -y gcc make && \
  19 + curl --silent --output /tmp/redis.tgz ${REDIS_INSTALLER_URL} && \
  20 + echo -n "${REDIS_INSTALLER_SHA256SUM} /tmp/redis.tgz" | sha256sum --check && \
  21 + tar -C ${redisPrefix} -xzvf /tmp/redis.tgz && rm -f /tmp/redis.tgz && \
  22 + make --directory=${redisPrefix}/redis-${REDIS_VERSION} distclean install && \
  23 + yum remove -y gcc make && yum autoremove -y && \
  24 + rm -rf ${redisPrefix}/redis-${REDIS_VERSION} && \
  25 + mkdir -p ${redisLocation} /etc/redis /var/log/redis && \
  26 + touch /etc/redis/redis-server.log && \
  27 + chown -R redis:redis ${redisLocation} /opt /etc/redis /var/log/redis
  28 +
  29 +COPY ./FILES/redis.conf /etc/redis/redis.conf
  30 +
  31 +RUN chown -R redis:redis /etc/redis
  32 +
  33 +USER redis
  34 +
  35 +WORKDIR ${redisLocation}
  36 +
  37 +VOLUME ${redisLocation}
  38 +
  39 +EXPOSE 6379
  40 +
  41 +ENTRYPOINT ["redis-server"]
... ...
commons/redis/3.2.8/FILES/redis.conf 0 → 100644
... ... @@ -0,0 +1,943 @@
  1 +# Redis configuration file example.
  2 +#
  3 +# Note that in order to read the configuration file, Redis must be
  4 +# started with the file path as first argument:
  5 +#
  6 +# ./redis-server /path/to/redis.conf
  7 +
  8 +# Note on units: when memory size is needed, it is possible to specify
  9 +# it in the usual form of 1k 5GB 4M and so forth:
  10 +#
  11 +# 1k => 1000 bytes
  12 +# 1kb => 1024 bytes
  13 +# 1m => 1000000 bytes
  14 +# 1mb => 1024*1024 bytes
  15 +# 1g => 1000000000 bytes
  16 +# 1gb => 1024*1024*1024 bytes
  17 +#
  18 +# units are case insensitive so 1GB 1Gb 1gB are all the same.
  19 +
  20 +################################## INCLUDES ###################################
  21 +
  22 +# Include one or more other config files here. This is useful if you
  23 +# have a standard template that goes to all Redis servers but also need
  24 +# to customize a few per-server settings. Include files can include
  25 +# other files, so use this wisely.
  26 +#
  27 +# Notice option "include" won't be rewritten by command "CONFIG REWRITE"
  28 +# from admin or Redis Sentinel. Since Redis always uses the last processed
  29 +# line as value of a configuration directive, you'd better put includes
  30 +# at the beginning of this file to avoid overwriting config change at runtime.
  31 +#
  32 +# If instead you are interested in using includes to override configuration
  33 +# options, it is better to use include as the last line.
  34 +#
  35 +# include /path/to/local.conf
  36 +# include /path/to/other.conf
  37 +
  38 +################################ GENERAL #####################################
  39 +
  40 +# By default Redis does not run as a daemon. Use 'yes' if you need it.
  41 +# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
  42 +daemonize no
  43 +
  44 +# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
  45 +# default. You can specify a custom pid file location here.
  46 +pidfile /var/run/redis/redis-server.pid
  47 +
  48 +# Accept connections on the specified port, default is 6379.
  49 +# If port 0 is specified Redis will not listen on a TCP socket.
  50 +port 6379
  51 +
  52 +# TCP listen() backlog.
  53 +#
  54 +# In high requests-per-second environments you need an high backlog in order
  55 +# to avoid slow clients connections issues. Note that the Linux kernel
  56 +# will silently truncate it to the value of /proc/sys/net/core/somaxconn so
  57 +# make sure to raise both the value of somaxconn and tcp_max_syn_backlog
  58 +# in order to get the desired effect.
  59 +tcp-backlog 511
  60 +
  61 +# By default Redis listens for connections from all the network interfaces
  62 +# available on the server. It is possible to listen to just one or multiple
  63 +# interfaces using the "bind" configuration directive, followed by one or
  64 +# more IP addresses.
  65 +#
  66 +# Examples:
  67 +#
  68 +# bind 192.168.1.100 10.0.0.1
  69 +bind 0.0.0.0
  70 +
  71 +# Specify the path for the Unix socket that will be used to listen for
  72 +# incoming connections. There is no default, so Redis will not listen
  73 +# on a unix socket when not specified.
  74 +#
  75 +# unixsocket /var/run/redis/redis.sock
  76 +# unixsocketperm 700
  77 +
  78 +# Close the connection after a client is idle for N seconds (0 to disable)
  79 +timeout 0
  80 +
  81 +# TCP keepalive.
  82 +#
  83 +# If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence
  84 +# of communication. This is useful for two reasons:
  85 +#
  86 +# 1) Detect dead peers.
  87 +# 2) Take the connection alive from the point of view of network
  88 +# equipment in the middle.
  89 +#
  90 +# On Linux, the specified value (in seconds) is the period used to send ACKs.
  91 +# Note that to close the connection the double of the time is needed.
  92 +# On other kernels the period depends on the kernel configuration.
  93 +#
  94 +# A reasonable value for this option is 60 seconds.
  95 +tcp-keepalive 0
  96 +
  97 +# Specify the server verbosity level.
  98 +# This can be one of:
  99 +# debug (a lot of information, useful for development/testing)
  100 +# verbose (many rarely useful info, but not a mess like the debug level)
  101 +# notice (moderately verbose, what you want in production probably)
  102 +# warning (only very important / critical messages are logged)
  103 +loglevel notice
  104 +
  105 +# Specify the log file name. Also the empty string can be used to force
  106 +# Redis to log on the standard output. Note that if you use standard
  107 +# output for logging but daemonize, logs will be sent to /dev/null
  108 +logfile /var/log/redis/redis-server.log
  109 +
  110 +# To enable logging to the system logger, just set 'syslog-enabled' to yes,
  111 +# and optionally update the other syslog parameters to suit your needs.
  112 +# syslog-enabled no
  113 +
  114 +# Specify the syslog identity.
  115 +# syslog-ident redis
  116 +
  117 +# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
  118 +# syslog-facility local0
  119 +
  120 +# Set the number of databases. The default database is DB 0, you can select
  121 +# a different one on a per-connection basis using SELECT <dbid> where
  122 +# dbid is a number between 0 and 'databases'-1
  123 +databases 16
  124 +
  125 +################################ SNAPSHOTTING ################################
  126 +#
  127 +# Save the DB on disk:
  128 +#
  129 +# save <seconds> <changes>
  130 +#
  131 +# Will save the DB if both the given number of seconds and the given
  132 +# number of write operations against the DB occurred.
  133 +#
  134 +# In the example below the behaviour will be to save:
  135 +# after 900 sec (15 min) if at least 1 key changed
  136 +# after 300 sec (5 min) if at least 10 keys changed
  137 +# after 60 sec if at least 10000 keys changed
  138 +#
  139 +# Note: you can disable saving completely by commenting out all "save" lines.
  140 +#
  141 +# It is also possible to remove all the previously configured save
  142 +# points by adding a save directive with a single empty string argument
  143 +# like in the following example:
  144 +#
  145 +# save ""
  146 +
  147 +save 900 1
  148 +save 300 10
  149 +save 60 10000
  150 +
  151 +# By default Redis will stop accepting writes if RDB snapshots are enabled
  152 +# (at least one save point) and the latest background save failed.
  153 +# This will make the user aware (in a hard way) that data is not persisting
  154 +# on disk properly, otherwise chances are that no one will notice and some
  155 +# disaster will happen.
  156 +#
  157 +# If the background saving process will start working again Redis will
  158 +# automatically allow writes again.
  159 +#
  160 +# However if you have setup your proper monitoring of the Redis server
  161 +# and persistence, you may want to disable this feature so that Redis will
  162 +# continue to work as usual even if there are problems with disk,
  163 +# permissions, and so forth.
  164 +stop-writes-on-bgsave-error yes
  165 +
  166 +# Compress string objects using LZF when dump .rdb databases?
  167 +# For default that's set to 'yes' as it's almost always a win.
  168 +# If you want to save some CPU in the saving child set it to 'no' but
  169 +# the dataset will likely be bigger if you have compressible values or keys.
  170 +rdbcompression yes
  171 +
  172 +# Since version 5 of RDB a CRC64 checksum is placed at the end of the file.
  173 +# This makes the format more resistant to corruption but there is a performance
  174 +# hit to pay (around 10%) when saving and loading RDB files, so you can disable it
  175 +# for maximum performances.
  176 +#
  177 +# RDB files created with checksum disabled have a checksum of zero that will
  178 +# tell the loading code to skip the check.
  179 +rdbchecksum yes
  180 +
  181 +# The filename where to dump the DB
  182 +dbfilename dump.rdb
  183 +
  184 +# The working directory.
  185 +#
  186 +# The DB will be written inside this directory, with the filename specified
  187 +# above using the 'dbfilename' configuration directive.
  188 +#
  189 +# The Append Only File will also be created inside this directory.
  190 +#
  191 +# Note that you must specify a directory here, not a file name.
  192 +dir /var/lib/redis
  193 +
  194 +################################# REPLICATION #################################
  195 +
  196 +# Master-Slave replication. Use slaveof to make a Redis instance a copy of
  197 +# another Redis server. A few things to understand ASAP about Redis replication.
  198 +#
  199 +# 1) Redis replication is asynchronous, but you can configure a master to
  200 +# stop accepting writes if it appears to be not connected with at least
  201 +# a given number of slaves.
  202 +# 2) Redis slaves are able to perform a partial resynchronization with the
  203 +# master if the replication link is lost for a relatively small amount of
  204 +# time. You may want to configure the replication backlog size (see the next
  205 +# sections of this file) with a sensible value depending on your needs.
  206 +# 3) Replication is automatic and does not need user intervention. After a
  207 +# network partition slaves automatically try to reconnect to masters
  208 +# and resynchronize with them.
  209 +#
  210 +# slaveof <masterip> <masterport>
  211 +
  212 +# If the master is password protected (using the "requirepass" configuration
  213 +# directive below) it is possible to tell the slave to authenticate before
  214 +# starting the replication synchronization process, otherwise the master will
  215 +# refuse the slave request.
  216 +#
  217 +# masterauth <master-password>
  218 +
  219 +# When a slave loses its connection with the master, or when the replication
  220 +# is still in progress, the slave can act in two different ways:
  221 +#
  222 +# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
  223 +# still reply to client requests, possibly with out of date data, or the
  224 +# data set may just be empty if this is the first synchronization.
  225 +#
  226 +# 2) if slave-serve-stale-data is set to 'no' the slave will reply with
  227 +# an error "SYNC with master in progress" to all the kind of commands
  228 +# but to INFO and SLAVEOF.
  229 +#
  230 +slave-serve-stale-data yes
  231 +
  232 +# You can configure a slave instance to accept writes or not. Writing against
  233 +# a slave instance may be useful to store some ephemeral data (because data
  234 +# written on a slave will be easily deleted after resync with the master) but
  235 +# may also cause problems if clients are writing to it because of a
  236 +# misconfiguration.
  237 +#
  238 +# Since Redis 2.6 by default slaves are read-only.
  239 +#
  240 +# Note: read only slaves are not designed to be exposed to untrusted clients
  241 +# on the internet. It's just a protection layer against misuse of the instance.
  242 +# Still a read only slave exports by default all the administrative commands
  243 +# such as CONFIG, DEBUG, and so forth. To a limited extent you can improve
  244 +# security of read only slaves using 'rename-command' to shadow all the
  245 +# administrative / dangerous commands.
  246 +slave-read-only yes
  247 +
  248 +# Replication SYNC strategy: disk or socket.
  249 +#
  250 +# -------------------------------------------------------
  251 +# WARNING: DISKLESS REPLICATION IS EXPERIMENTAL CURRENTLY
  252 +# -------------------------------------------------------
  253 +#
  254 +# New slaves and reconnecting slaves that are not able to continue the replication
  255 +# process just receiving differences, need to do what is called a "full
  256 +# synchronization". An RDB file is transmitted from the master to the slaves.
  257 +# The transmission can happen in two different ways:
  258 +#
  259 +# 1) Disk-backed: The Redis master creates a new process that writes the RDB
  260 +# file on disk. Later the file is transferred by the parent
  261 +# process to the slaves incrementally.
  262 +# 2) Diskless: The Redis master creates a new process that directly writes the
  263 +# RDB file to slave sockets, without touching the disk at all.
  264 +#
  265 +# With disk-backed replication, while the RDB file is generated, more slaves
  266 +# can be queued and served with the RDB file as soon as the current child producing
  267 +# the RDB file finishes its work. With diskless replication instead once
  268 +# the transfer starts, new slaves arriving will be queued and a new transfer
  269 +# will start when the current one terminates.
  270 +#
  271 +# When diskless replication is used, the master waits a configurable amount of
  272 +# time (in seconds) before starting the transfer in the hope that multiple slaves
  273 +# will arrive and the transfer can be parallelized.
  274 +#
  275 +# With slow disks and fast (large bandwidth) networks, diskless replication
  276 +# works better.
  277 +repl-diskless-sync no
  278 +
  279 +# When diskless replication is enabled, it is possible to configure the delay
  280 +# the server waits in order to spawn the child that transfers the RDB via socket
  281 +# to the slaves.
  282 +#
  283 +# This is important since once the transfer starts, it is not possible to serve
  284 +# new slaves arriving, that will be queued for the next RDB transfer, so the server
  285 +# waits a delay in order to let more slaves arrive.
  286 +#
  287 +# The delay is specified in seconds, and by default is 5 seconds. To disable
  288 +# it entirely just set it to 0 seconds and the transfer will start ASAP.
  289 +repl-diskless-sync-delay 5
  290 +
  291 +# Slaves send PINGs to server in a predefined interval. It's possible to change