diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..d297f14d1d1f6bef4704f04712287f7e73a5b52e --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,26 @@ +variables: + image_version: '11.33.3' + DOCKER_URL: 'dockerregistry.c3sl.ufpr.br:5000/c3sl/monetdb-ci-service' + +stages: + - build + - deploy + +build: + stage: build + script: + - docker build -t ${DOCKER_URL}:${image_version} -t ${DOCKER_URL}:latest . + tags: + - docker + - build + +deploy: + stage: deploy + script: + - docker push ${DOCKER_URL}:${image_version} + - docker push ${DOCKER_URL}:latest + tags: + - docker + - build + only: + - master diff --git a/Dockerfile b/Dockerfile index 484a4ee10052a64423eadb64e07b8f1b532eafe0..64704d11c3a33cfa5b6a98041c2ec676bbbc9af4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,7 @@ RUN yum install -y https://www.monetdb.org/downloads/epel/MonetDB-release-epel.n RUN yum update -y && \ yum upgrade -y -ARG MonetDBVersion=11.31.7 +ARG MonetDBVersion=11.33.3 # Install MonetDB server RUN yum install -y MonetDB-$MonetDBVersion \ @@ -89,3 +89,14 @@ RUN su -c 'sh /home/monetdb/init-db.sh' monetdb CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] +# CUSTOM + +ENV MONETDB_NAME dbmonet +ENV MONETDB_USER dbmonet +ENV MONETDB_PASSWORD dbmonet + +WORKDIR /home/monetdb + +COPY script.sh /etc/script/script.sh + +CMD ["/bin/bash", "/etc/script/script.sh"] diff --git a/script.sh b/script.sh new file mode 100644 index 0000000000000000000000000000000000000000..a6b0a2614c537ccfb4729b603f93af89e3cf520b --- /dev/null +++ b/script.sh @@ -0,0 +1,25 @@ +/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf & +# the first argument will the database name +condition=true +while $condition ; do +# it will create a database called monetdb +monetdb create $MONETDB_NAME +# $? is the result 0 for sucess 1 for err +try=$? +if [ $try == "0" ] + then + # the test has succeed + condition=false + else + # the test has failed will try again in 5s + sleep 5s +fi +done +monetdb release $MONETDB_NAME +# .monetdb will be read when mclient is called without user and password +echo "user=monetdb" > .monetdb +echo "password=monetdb" >> .monetdb +mclient -d $MONETDB_NAME -s "create user \"$MONETDB_USER\" with password '$MONETDB_PASSWORD' name 'ci' schema \"sys\""; +echo "user=$MONETDB_USER" > .monetdb +echo "password=$MONETDB_PASSWORD" >> .monetdb +wait \ No newline at end of file