From d60d5b8f90dd69258ddedc54c3e1b905d9e0e093 Mon Sep 17 00:00:00 2001 From: Tiago-Salles Date: Mon, 13 Jan 2025 17:11:52 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B1(cookiecutter)=20added=20org=5Fdock?= =?UTF-8?q?erhub=20parameter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The intention is to provide flexibility to fetch images from a given dockerhub, and when it is not provided, the dockerhub continues following the standard which is fundocker. --- CHANGELOG.md | 2 ++ cookiecutter/cookiecutter.json | 1 + .../.circleci/src/jobs/@docker.yml | 24 +++++++++---------- .../.cookiecutter_default.yml | 1 + .../Dockerfile | 2 +- .../Makefile | 2 +- .../docker-compose.yml | 4 ++-- .../template/cookiecutter.json | 1 + 8 files changed, 21 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b3cd48d3b..11cd10e554 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ Versioning](https://semver.org/spec/v2.0.0.html). - Add Additional Information section for a category and use them in a course page - Added new page extension `MainMenuEntry` +- Added database selection to activate script +- Added org_dockerhub parameter to cookiecutter ### Fixed diff --git a/cookiecutter/cookiecutter.json b/cookiecutter/cookiecutter.json index e95b9b94c4..71487e9aae 100644 --- a/cookiecutter/cookiecutter.json +++ b/cookiecutter/cookiecutter.json @@ -1,5 +1,6 @@ { "organization": null, + "org_dockerhub": "fundocker", "_copy_without_render": [ ".circleci", "bin/activate", diff --git a/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/.circleci/src/jobs/@docker.yml b/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/.circleci/src/jobs/@docker.yml index 5c20c591bf..0f0541712d 100644 --- a/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/.circleci/src/jobs/@docker.yml +++ b/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/.circleci/src/jobs/@docker.yml @@ -75,39 +75,39 @@ hub: - run: name: Tag app image command: | - docker images fundocker/<< parameters.image_name >> + docker images {{cookiecutter.org_dockerhub}}/<< parameters.image_name >> # Display either: # - DOCKER_TAG: main (Git branch) # or # - DOCKER_TAG: 1.1.2 (Git tag v1.1.2) echo "DOCKER_TAG: ${DOCKER_TAG}" - docker tag << parameters.site >>:production fundocker/<< parameters.image_name >>:${DOCKER_TAG} + docker tag << parameters.site >>:production {{cookiecutter.org_dockerhub}}/<< parameters.image_name >>:${DOCKER_TAG} if [[ -n "$CIRCLE_TAG" ]]; then - docker tag << parameters.site >>:production fundocker/<< parameters.image_name >>:latest + docker tag << parameters.site >>:production {{cookiecutter.org_dockerhub}}/<< parameters.image_name >>:latest fi - docker images | grep -E "^fundocker/<< parameters.image_name >>\s*(${DOCKER_TAG}.*|latest|main)" + docker images | grep -E "^{{cookiecutter.org_dockerhub}}/<< parameters.image_name >>\s*(${DOCKER_TAG}.*|latest|main)" - run: name: Tag nginx image command: | - docker images fundocker/<< parameters.image_name >>-nginx + docker images {{cookiecutter.org_dockerhub}}/<< parameters.image_name >>-nginx echo "DOCKER_TAG: ${DOCKER_TAG}" - docker tag << parameters.site >>-nginx:production fundocker/<< parameters.image_name >>-nginx:${DOCKER_TAG} + docker tag << parameters.site >>-nginx:production {{cookiecutter.org_dockerhub}}/<< parameters.image_name >>-nginx:${DOCKER_TAG} if [[ -n "$CIRCLE_TAG" ]]; then - docker tag << parameters.site >>-nginx:production fundocker/<< parameters.image_name >>-nginx:latest + docker tag << parameters.site >>-nginx:production {{cookiecutter.org_dockerhub}}/<< parameters.image_name >>-nginx:latest fi - docker images | grep -E "^fundocker/<< parameters.image_name >>-nginx\s*(${DOCKER_TAG}.*|latest|main)" + docker images | grep -E "^{{cookiecutter.org_dockerhub}}/<< parameters.image_name >>-nginx\s*(${DOCKER_TAG}.*|latest|main)" # Publish images - run: name: Publish app image command: | - docker push fundocker/<< parameters.image_name >>:${DOCKER_TAG} + docker push {{cookiecutter.org_dockerhub}}/<< parameters.image_name >>:${DOCKER_TAG} if [[ -n "$CIRCLE_TAG" ]]; then - docker push fundocker/<< parameters.image_name >>:latest + docker push {{cookiecutter.org_dockerhub}}/<< parameters.image_name >>:latest fi - run: name: Publish nginx image command: | - docker push fundocker/<< parameters.image_name >>-nginx:${DOCKER_TAG} + docker push {{cookiecutter.org_dockerhub}}/<< parameters.image_name >>-nginx:${DOCKER_TAG} if [[ -n "$CIRCLE_TAG" ]]; then - docker push fundocker/<< parameters.image_name >>-nginx:latest + docker push {{cookiecutter.org_dockerhub}}/<< parameters.image_name >>-nginx:latest fi diff --git a/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/.cookiecutter_default.yml b/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/.cookiecutter_default.yml index 0778a7168d..3455390e2b 100644 --- a/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/.cookiecutter_default.yml +++ b/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/.cookiecutter_default.yml @@ -1,2 +1,3 @@ default_context: _organization: {{cookiecutter.organization}} + _org_dockerhub: {{cookiecutter.org_dockerhub}} diff --git a/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/Dockerfile b/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/Dockerfile index 5583ec5bd7..0258d1cfbd 100644 --- a/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/Dockerfile +++ b/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/Dockerfile @@ -1,4 +1,4 @@ -ARG NGINX_IMAGE_NAME=fundocker/openshift-nginx +ARG NGINX_IMAGE_NAME={{cookiecutter.org_dockerhub}}/openshift-nginx ARG NGINX_IMAGE_TAG=1.13 ARG STATIC_ROOT=/data/static ARG SITE diff --git a/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/Makefile b/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/Makefile index c9f62b03d4..139796ce8b 100644 --- a/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/Makefile +++ b/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/Makefile @@ -11,7 +11,7 @@ COLOR_RESET = \033[0m # -- Docker DOCKER_UID = $(shell id -u) DOCKER_GID = $(shell id -g) -NGINX_IMAGE_NAME = fundocker/openshift-nginx +NGINX_IMAGE_NAME = {{cookiecutter.org_dockerhub}}/openshift-nginx NGINX_IMAGE_TAG = 1.13 COMPOSE = \ diff --git a/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/docker-compose.yml b/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/docker-compose.yml index c20dedca3e..15530c655e 100644 --- a/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/docker-compose.yml +++ b/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/docker-compose.yml @@ -2,7 +2,7 @@ include: - docker-compose-${ACTIVATED_DB}.yml services: elasticsearch: - image: fundocker/openshift-elasticsearch:6.6.2 + image: {{cookiecutter.org_dockerhub}}/openshift-elasticsearch:6.6.2 environment: - discovery.type=single-node env_file: @@ -73,7 +73,7 @@ services: target: nginx args: DOCKER_USER: ${DOCKER_USER:-1000} - NGINX_IMAGE_NAME: ${NGINX_IMAGE_NAME:-fundocker/openshift-nginx} + NGINX_IMAGE_NAME: ${NGINX_IMAGE_NAME:-{{cookiecutter.org_dockerhub}}/openshift-nginx} NGINX_IMAGE_TAG: ${NGINX_IMAGE_TAG:-1.13} SITE: ${RICHIE_SITE:?} image: "${RICHIE_SITE:?}-nginx:production" diff --git a/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/template/cookiecutter.json b/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/template/cookiecutter.json index 572c1afc8d..db08886d1a 100644 --- a/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/template/cookiecutter.json +++ b/cookiecutter/{{cookiecutter.organization}}-richie-site-factory/template/cookiecutter.json @@ -1,5 +1,6 @@ { "_organization": null, + "_org_dockerhub": null, "site": null, "domain": null }