From a4685d6981ab34ba03c5e37b8e61d0f6c699e03d Mon Sep 17 00:00:00 2001 From: Thomas Misilo Date: Wed, 9 Feb 2022 13:06:27 -0600 Subject: [PATCH 1/4] Move docker-compose files to subdirectory Fixes #221 - Update context to the new locations in docker-compose.*.yml files - Move tls.yml to `build` directory and rename file to traefik-tls.yml. Since this file is in SCM, it isn't expected to be modified. --- Makefile | 4 +-- .../docker-compose/docker-compose.acme.yml | 2 +- .../docker-compose.activemq.yml | 0 .../docker-compose/docker-compose.alpaca.yml | 0 .../docker-compose.blazegraph.yml | 0 .../docker-compose.cantaloupe.yml | 0 .../docker-compose.code-server.yml | 2 +- .../docker-compose.crayfish.yml | 0 .../docker-compose.crayfits.yml | 0 .../docker-compose/docker-compose.custom.yml | 2 +- .../docker-compose/docker-compose.demo.yml | 0 .../docker-compose.drupal.mariadb.yml | 0 .../docker-compose.drupal.postgresql.yml | 0 .../docker-compose/docker-compose.drupal.yml | 0 .../docker-compose/docker-compose.etcd.yml | 0 .../docker-compose.fcrepo.mariadb.yml | 0 .../docker-compose.fcrepo.postgresql.yml | 0 .../docker-compose/docker-compose.fcrepo.yml | 0 .../docker-compose.fcrepo6.mariadb.yml | 0 .../docker-compose.fcrepo6.postgresql.yml | 0 .../docker-compose/docker-compose.fcrepo6.yml | 0 .../docker-compose/docker-compose.local.yml | 2 +- .../docker-compose/docker-compose.mariadb.yml | 0 .../docker-compose/docker-compose.matomo.yml | 0 .../docker-compose.postgresql.yml | 0 .../docker-compose/docker-compose.secrets.yml | 32 +++++++++---------- .../docker-compose/docker-compose.solr.yml | 0 .../docker-compose/docker-compose.traefik.yml | 4 +-- .../docker-compose.watchtower.yml | 0 tls.yml => build/traefik-tls.yml | 0 30 files changed, 24 insertions(+), 24 deletions(-) rename docker-compose.acme.yml => build/docker-compose/docker-compose.acme.yml (98%) rename docker-compose.activemq.yml => build/docker-compose/docker-compose.activemq.yml (100%) rename docker-compose.alpaca.yml => build/docker-compose/docker-compose.alpaca.yml (100%) rename docker-compose.blazegraph.yml => build/docker-compose/docker-compose.blazegraph.yml (100%) rename docker-compose.cantaloupe.yml => build/docker-compose/docker-compose.cantaloupe.yml (100%) rename docker-compose.code-server.yml => build/docker-compose/docker-compose.code-server.yml (98%) rename docker-compose.crayfish.yml => build/docker-compose/docker-compose.crayfish.yml (100%) rename docker-compose.crayfits.yml => build/docker-compose/docker-compose.crayfits.yml (100%) rename docker-compose.custom.yml => build/docker-compose/docker-compose.custom.yml (98%) rename docker-compose.demo.yml => build/docker-compose/docker-compose.demo.yml (100%) rename docker-compose.drupal.mariadb.yml => build/docker-compose/docker-compose.drupal.mariadb.yml (100%) rename docker-compose.drupal.postgresql.yml => build/docker-compose/docker-compose.drupal.postgresql.yml (100%) rename docker-compose.drupal.yml => build/docker-compose/docker-compose.drupal.yml (100%) rename docker-compose.etcd.yml => build/docker-compose/docker-compose.etcd.yml (100%) rename docker-compose.fcrepo.mariadb.yml => build/docker-compose/docker-compose.fcrepo.mariadb.yml (100%) rename docker-compose.fcrepo.postgresql.yml => build/docker-compose/docker-compose.fcrepo.postgresql.yml (100%) rename docker-compose.fcrepo.yml => build/docker-compose/docker-compose.fcrepo.yml (100%) rename docker-compose.fcrepo6.mariadb.yml => build/docker-compose/docker-compose.fcrepo6.mariadb.yml (100%) rename docker-compose.fcrepo6.postgresql.yml => build/docker-compose/docker-compose.fcrepo6.postgresql.yml (100%) rename docker-compose.fcrepo6.yml => build/docker-compose/docker-compose.fcrepo6.yml (100%) rename docker-compose.local.yml => build/docker-compose/docker-compose.local.yml (96%) rename docker-compose.mariadb.yml => build/docker-compose/docker-compose.mariadb.yml (100%) rename docker-compose.matomo.yml => build/docker-compose/docker-compose.matomo.yml (100%) rename docker-compose.postgresql.yml => build/docker-compose/docker-compose.postgresql.yml (100%) rename docker-compose.secrets.yml => build/docker-compose/docker-compose.secrets.yml (64%) rename docker-compose.solr.yml => build/docker-compose/docker-compose.solr.yml (100%) rename docker-compose.traefik.yml => build/docker-compose/docker-compose.traefik.yml (96%) rename docker-compose.watchtower.yml => build/docker-compose/docker-compose.watchtower.yml (100%) rename tls.yml => build/traefik-tls.yml (100%) diff --git a/Makefile b/Makefile index d24da5591..d8b368e0d 100644 --- a/Makefile +++ b/Makefile @@ -89,8 +89,8 @@ SERVICES := $(REQUIRED_SERVICES) $(FCREPO_SERVICE) $(WATCHTOWER_SERVICE) $(ETCD_ default: download-default-certs docker-compose.yml pull .SILENT: docker-compose.yml -docker-compose.yml: $(SERVICES:%=docker-compose.%.yml) .env - docker-compose $(SERVICES:%=-f docker-compose.%.yml) config > docker-compose.yml +docker-compose.yml: $(SERVICES:%=build/docker-compose/docker-compose.%.yml) .env + docker-compose $(SERVICES:%=-f build/docker-compose/docker-compose.%.yml) config > docker-compose.yml .PHONY: pull ## Fetches the latest images from the registry. diff --git a/docker-compose.acme.yml b/build/docker-compose/docker-compose.acme.yml similarity index 98% rename from docker-compose.acme.yml rename to build/docker-compose/docker-compose.acme.yml index de43d6d70..ae3b50c26 100644 --- a/docker-compose.acme.yml +++ b/build/docker-compose/docker-compose.acme.yml @@ -29,7 +29,7 @@ services: - --certificatesresolvers.myresolver.acme.storage=/acme/acme.json - --certificatesResolvers.myresolver.acme.caServer=${ACME_SERVER-https://acme-v02.api.letsencrypt.org/directory} volumes: - - ./acme:/acme:rw + - ../../acme:/acme:rw cantaloupe: labels: - traefik.http.routers.${COMPOSE_PROJECT_NAME-isle-dc}-cantaloupe_https.tls.certresolver=myresolver diff --git a/docker-compose.activemq.yml b/build/docker-compose/docker-compose.activemq.yml similarity index 100% rename from docker-compose.activemq.yml rename to build/docker-compose/docker-compose.activemq.yml diff --git a/docker-compose.alpaca.yml b/build/docker-compose/docker-compose.alpaca.yml similarity index 100% rename from docker-compose.alpaca.yml rename to build/docker-compose/docker-compose.alpaca.yml diff --git a/docker-compose.blazegraph.yml b/build/docker-compose/docker-compose.blazegraph.yml similarity index 100% rename from docker-compose.blazegraph.yml rename to build/docker-compose/docker-compose.blazegraph.yml diff --git a/docker-compose.cantaloupe.yml b/build/docker-compose/docker-compose.cantaloupe.yml similarity index 100% rename from docker-compose.cantaloupe.yml rename to build/docker-compose/docker-compose.cantaloupe.yml diff --git a/docker-compose.code-server.yml b/build/docker-compose/docker-compose.code-server.yml similarity index 98% rename from docker-compose.code-server.yml rename to build/docker-compose/docker-compose.code-server.yml index 3129c5872..28528900c 100644 --- a/docker-compose.code-server.yml +++ b/build/docker-compose/docker-compose.code-server.yml @@ -10,7 +10,7 @@ networks: external: true secrets: CODE_SERVER_PASSWORD: - file: "./secrets/live/CODE_SERVER_PASSWORD" + file: "../../secrets/live/CODE_SERVER_PASSWORD" services: code-server: environment: diff --git a/docker-compose.crayfish.yml b/build/docker-compose/docker-compose.crayfish.yml similarity index 100% rename from docker-compose.crayfish.yml rename to build/docker-compose/docker-compose.crayfish.yml diff --git a/docker-compose.crayfits.yml b/build/docker-compose/docker-compose.crayfits.yml similarity index 100% rename from docker-compose.crayfits.yml rename to build/docker-compose/docker-compose.crayfits.yml diff --git a/docker-compose.custom.yml b/build/docker-compose/docker-compose.custom.yml similarity index 98% rename from docker-compose.custom.yml rename to build/docker-compose/docker-compose.custom.yml index 8d5aec43f..83dcdccf0 100644 --- a/docker-compose.custom.yml +++ b/build/docker-compose/docker-compose.custom.yml @@ -12,7 +12,7 @@ services: # The service name is drupal that is the default host name used by micro-services etc. drupal: build: - context: ./ + context: ../../ dockerfile: ${PROJECT_DRUPAL_DOCKERFILE:-./Dockerfile} environment: # diff --git a/docker-compose.demo.yml b/build/docker-compose/docker-compose.demo.yml similarity index 100% rename from docker-compose.demo.yml rename to build/docker-compose/docker-compose.demo.yml diff --git a/docker-compose.drupal.mariadb.yml b/build/docker-compose/docker-compose.drupal.mariadb.yml similarity index 100% rename from docker-compose.drupal.mariadb.yml rename to build/docker-compose/docker-compose.drupal.mariadb.yml diff --git a/docker-compose.drupal.postgresql.yml b/build/docker-compose/docker-compose.drupal.postgresql.yml similarity index 100% rename from docker-compose.drupal.postgresql.yml rename to build/docker-compose/docker-compose.drupal.postgresql.yml diff --git a/docker-compose.drupal.yml b/build/docker-compose/docker-compose.drupal.yml similarity index 100% rename from docker-compose.drupal.yml rename to build/docker-compose/docker-compose.drupal.yml diff --git a/docker-compose.etcd.yml b/build/docker-compose/docker-compose.etcd.yml similarity index 100% rename from docker-compose.etcd.yml rename to build/docker-compose/docker-compose.etcd.yml diff --git a/docker-compose.fcrepo.mariadb.yml b/build/docker-compose/docker-compose.fcrepo.mariadb.yml similarity index 100% rename from docker-compose.fcrepo.mariadb.yml rename to build/docker-compose/docker-compose.fcrepo.mariadb.yml diff --git a/docker-compose.fcrepo.postgresql.yml b/build/docker-compose/docker-compose.fcrepo.postgresql.yml similarity index 100% rename from docker-compose.fcrepo.postgresql.yml rename to build/docker-compose/docker-compose.fcrepo.postgresql.yml diff --git a/docker-compose.fcrepo.yml b/build/docker-compose/docker-compose.fcrepo.yml similarity index 100% rename from docker-compose.fcrepo.yml rename to build/docker-compose/docker-compose.fcrepo.yml diff --git a/docker-compose.fcrepo6.mariadb.yml b/build/docker-compose/docker-compose.fcrepo6.mariadb.yml similarity index 100% rename from docker-compose.fcrepo6.mariadb.yml rename to build/docker-compose/docker-compose.fcrepo6.mariadb.yml diff --git a/docker-compose.fcrepo6.postgresql.yml b/build/docker-compose/docker-compose.fcrepo6.postgresql.yml similarity index 100% rename from docker-compose.fcrepo6.postgresql.yml rename to build/docker-compose/docker-compose.fcrepo6.postgresql.yml diff --git a/docker-compose.fcrepo6.yml b/build/docker-compose/docker-compose.fcrepo6.yml similarity index 100% rename from docker-compose.fcrepo6.yml rename to build/docker-compose/docker-compose.fcrepo6.yml diff --git a/docker-compose.local.yml b/build/docker-compose/docker-compose.local.yml similarity index 96% rename from docker-compose.local.yml rename to build/docker-compose/docker-compose.local.yml index 1e81ea182..f4f44103d 100644 --- a/docker-compose.local.yml +++ b/build/docker-compose/docker-compose.local.yml @@ -18,7 +18,7 @@ services: restart: ${RESTART_POLICY:-unless-stopped} image: ${REPOSITORY:-islandora}/drupal:${TAG:-latest} volumes: - - ./codebase:/var/www/drupal:delegated + - ../../codebase:/var/www/drupal:delegated - drupal-sites-data:/var/www/drupal/web/sites/default/files - solr-data:/opt/solr/server/solr environment: diff --git a/docker-compose.mariadb.yml b/build/docker-compose/docker-compose.mariadb.yml similarity index 100% rename from docker-compose.mariadb.yml rename to build/docker-compose/docker-compose.mariadb.yml diff --git a/docker-compose.matomo.yml b/build/docker-compose/docker-compose.matomo.yml similarity index 100% rename from docker-compose.matomo.yml rename to build/docker-compose/docker-compose.matomo.yml diff --git a/docker-compose.postgresql.yml b/build/docker-compose/docker-compose.postgresql.yml similarity index 100% rename from docker-compose.postgresql.yml rename to build/docker-compose/docker-compose.postgresql.yml diff --git a/docker-compose.secrets.yml b/build/docker-compose/docker-compose.secrets.yml similarity index 64% rename from docker-compose.secrets.yml rename to build/docker-compose/docker-compose.secrets.yml index 8d77dbc26..142b56658 100644 --- a/docker-compose.secrets.yml +++ b/build/docker-compose/docker-compose.secrets.yml @@ -1,37 +1,37 @@ version: "3.7" secrets: ACTIVEMQ_PASSWORD: - file: "./secrets/live/ACTIVEMQ_PASSWORD" + file: "../../secrets/live/ACTIVEMQ_PASSWORD" ACTIVEMQ_WEB_ADMIN_PASSWORD: - file: "./secrets/live/ACTIVEMQ_WEB_ADMIN_PASSWORD" + file: "../../secrets/live/ACTIVEMQ_WEB_ADMIN_PASSWORD" ALPACA_ACTIVEMQ_PASSWORD: - file: "./secrets/live/ALPACA_ACTIVEMQ_PASSWORD" + file: "../../secrets/live/ALPACA_ACTIVEMQ_PASSWORD" ALPACA_KARAF_ADMIN_PASSWORD: - file: "./secrets/live/ALPACA_KARAF_ADMIN_PASSWORD" + file: "../../secrets/live/ALPACA_KARAF_ADMIN_PASSWORD" DB_ROOT_PASSWORD: - file: "./secrets/live/DB_ROOT_PASSWORD" + file: "../../secrets/live/DB_ROOT_PASSWORD" DRUPAL_DEFAULT_ACCOUNT_PASSWORD: - file: "./secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD" + file: "../../secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD" DRUPAL_DEFAULT_CONFIGDIR: - file: "./secrets/live/DRUPAL_DEFAULT_CONFIGDIR" + file: "../../secrets/live/DRUPAL_DEFAULT_CONFIGDIR" DRUPAL_DEFAULT_DB_PASSWORD: - file: "./secrets/live/DRUPAL_DEFAULT_DB_PASSWORD" + file: "../../secrets/live/DRUPAL_DEFAULT_DB_PASSWORD" DRUPAL_DEFAULT_SALT: - file: "./secrets/live/DRUPAL_DEFAULT_SALT" + file: "../../secrets/live/DRUPAL_DEFAULT_SALT" FCREPO_DB_PASSWORD: - file: "./secrets/live/FCREPO_DB_PASSWORD" + file: "../../secrets/live/FCREPO_DB_PASSWORD" JWT_ADMIN_TOKEN: - file: "./secrets/live/JWT_ADMIN_TOKEN" + file: "../../secrets/live/JWT_ADMIN_TOKEN" JWT_PUBLIC_KEY: - file: "./secrets/live/JWT_PUBLIC_KEY" + file: "../../secrets/live/JWT_PUBLIC_KEY" JWT_PRIVATE_KEY: - file: "./secrets/live/JWT_PRIVATE_KEY" + file: "../../secrets/live/JWT_PRIVATE_KEY" MATOMO_DB_PASSWORD: - file: "./secrets/live/MATOMO_DB_PASSWORD" + file: "../../secrets/live/MATOMO_DB_PASSWORD" MATOMO_USER_PASS: - file: "./secrets/live/MATOMO_USER_PASS" + file: "../../secrets/live/MATOMO_USER_PASS" TOMCAT_ADMIN_PASSWORD: - file: "./secrets/live/TOMCAT_ADMIN_PASSWORD" + file: "../../secrets/live/TOMCAT_ADMIN_PASSWORD" services: activemq: secrets: diff --git a/docker-compose.solr.yml b/build/docker-compose/docker-compose.solr.yml similarity index 100% rename from docker-compose.solr.yml rename to build/docker-compose/docker-compose.solr.yml diff --git a/docker-compose.traefik.yml b/build/docker-compose/docker-compose.traefik.yml similarity index 96% rename from docker-compose.traefik.yml rename to build/docker-compose/docker-compose.traefik.yml index 0793e24a8..481ec5d6a 100644 --- a/docker-compose.traefik.yml +++ b/build/docker-compose/docker-compose.traefik.yml @@ -53,8 +53,8 @@ services: - ${CODE_SERVER_PORT:-8443}:8443 # code-server volumes: - /var/run/docker.sock:/var/run/docker.sock - - ./tls.yml:/etc/traefik/tls.yml - - ./certs:/etc/ssl/traefik + - ../../build/traefik-tls.yml:/etc/traefik/tls.yml + - ../../certs:/etc/ssl/traefik labels: # Do not expose in production. - traefik.http.routers.api.service=api@internal diff --git a/docker-compose.watchtower.yml b/build/docker-compose/docker-compose.watchtower.yml similarity index 100% rename from docker-compose.watchtower.yml rename to build/docker-compose/docker-compose.watchtower.yml diff --git a/tls.yml b/build/traefik-tls.yml similarity index 100% rename from tls.yml rename to build/traefik-tls.yml From a5c7e530765b8a9e4ed50f3ebc2523da9ecb36ab Mon Sep 17 00:00:00 2001 From: Thomas Misilo Date: Wed, 9 Feb 2022 13:10:09 -0600 Subject: [PATCH 2/4] Move some files to a `build` directory since they are build artifacts --- Makefile | 12 ++++++------ .../demo-data}/browse-collections.json | 0 {demo-data => build/demo-data}/drupal.sql | 0 {demo-data => build/demo-data}/fcrepo-export.tgz | Bin {demo-data => build/demo-data}/homepage.json | 0 {demo-data => build/demo-data}/public-files.tgz | Bin .../rootfs}/etc/cont-init.d/04-custom-setup.sh | 0 {scripts => build/scripts}/check-secrets.sh | 4 ++-- {scripts => build/scripts}/generate-secrets.sh | 2 +- sample.Dockerfile | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) rename {demo-data => build/demo-data}/browse-collections.json (100%) rename {demo-data => build/demo-data}/drupal.sql (100%) rename {demo-data => build/demo-data}/fcrepo-export.tgz (100%) rename {demo-data => build/demo-data}/homepage.json (100%) rename {demo-data => build/demo-data}/public-files.tgz (100%) rename {rootfs => build/rootfs}/etc/cont-init.d/04-custom-setup.sh (100%) rename {scripts => build/scripts}/check-secrets.sh (97%) rename {scripts => build/scripts}/generate-secrets.sh (95%) diff --git a/Makefile b/Makefile index d8b368e0d..9e7a8b26f 100644 --- a/Makefile +++ b/Makefile @@ -301,7 +301,7 @@ generate-secrets: ifeq ($(USE_SECRETS), false) docker run --rm -t \ -v "$(CURDIR)/secrets":/secrets \ - -v "$(CURDIR)/scripts/generate-secrets.sh":/generate-secrets.sh \ + -v "$(CURDIR)/build/scripts/generate-secrets.sh":/generate-secrets.sh \ -w / \ --entrypoint bash \ $(REPOSITORY)/drupal:$(TAG) -c "/generate-secrets.sh && chown -R `id -u`:`id -g` /secrets" @@ -332,12 +332,12 @@ demo: generate-secrets mkdir -p "$(CURDIR)/codebase" docker-compose up -d $(MAKE) update-settings-php ENVIROMENT=demo - $(MAKE) drupal-public-files-import SRC="$(CURDIR)/demo-data/public-files.tgz" ENVIROMENT=demo + $(MAKE) drupal-public-files-import SRC="$(CURDIR)/build/demo-data/public-files.tgz" ENVIROMENT=demo $(MAKE) drupal-database ENVIROMENT=demo - $(MAKE) drupal-database-import SRC="$(CURDIR)/demo-data/drupal.sql" ENVIROMENT=demo + $(MAKE) drupal-database-import SRC="$(CURDIR)/build/demo-data/drupal.sql" ENVIROMENT=demo $(MAKE) hydrate ENVIROMENT=demo docker-compose exec -T drupal with-contenv bash -lc 'drush --root /var/www/drupal/web -l $${DRUPAL_DEFAULT_SITE_URL} upwd admin $${DRUPAL_DEFAULT_ACCOUNT_PASSWORD}' - $(MAKE) fcrepo-import SRC="$(CURDIR)/demo-data/fcrepo-export.tgz" ENVIROMENT=demo + $(MAKE) fcrepo-import SRC="$(CURDIR)/build/demo-data/fcrepo-export.tgz" ENVIROMENT=demo $(MAKE) reindex-fcrepo-metadata ENVIROMENT=demo $(MAKE) reindex-solr ENVIROMENT=demo $(MAKE) reindex-triplestore ENVIROMENT=demo @@ -489,8 +489,8 @@ help: .SILENT: secrets_warning ## Check to see if the secrets directory contains default secrets. secrets_warning: - @echo 'Starting scripts/check-secrets.sh' - @bash scripts/check-secrets.sh || (echo "check-secrets exited $$?"; exit 1) + @echo 'Starting build/scripts/check-secrets.sh' + @bash build/scripts/check-secrets.sh || (echo "check-secrets exited $$?"; exit 1) IS_DRUPAL_PSSWD_FILE_READABLE := $(shell test -r secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD -a -w secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD && echo 1 || echo 0) CMD := $(shell [ $(IS_DRUPAL_PSSWD_FILE_READABLE) -eq 1 ] && echo 'tee' || echo 'sudo -k tee') diff --git a/demo-data/browse-collections.json b/build/demo-data/browse-collections.json similarity index 100% rename from demo-data/browse-collections.json rename to build/demo-data/browse-collections.json diff --git a/demo-data/drupal.sql b/build/demo-data/drupal.sql similarity index 100% rename from demo-data/drupal.sql rename to build/demo-data/drupal.sql diff --git a/demo-data/fcrepo-export.tgz b/build/demo-data/fcrepo-export.tgz similarity index 100% rename from demo-data/fcrepo-export.tgz rename to build/demo-data/fcrepo-export.tgz diff --git a/demo-data/homepage.json b/build/demo-data/homepage.json similarity index 100% rename from demo-data/homepage.json rename to build/demo-data/homepage.json diff --git a/demo-data/public-files.tgz b/build/demo-data/public-files.tgz similarity index 100% rename from demo-data/public-files.tgz rename to build/demo-data/public-files.tgz diff --git a/rootfs/etc/cont-init.d/04-custom-setup.sh b/build/rootfs/etc/cont-init.d/04-custom-setup.sh similarity index 100% rename from rootfs/etc/cont-init.d/04-custom-setup.sh rename to build/rootfs/etc/cont-init.d/04-custom-setup.sh diff --git a/scripts/check-secrets.sh b/build/scripts/check-secrets.sh similarity index 97% rename from scripts/check-secrets.sh rename to build/scripts/check-secrets.sh index a6981a28b..075e01043 100755 --- a/scripts/check-secrets.sh +++ b/build/scripts/check-secrets.sh @@ -76,7 +76,7 @@ function main() { if [[ ${ans} == [yY] ]] ; then docker run --rm -t \ -v $(pwd)/secrets:/secrets \ - -v $(pwd)/scripts/generate-secrets.sh:/generate-secrets.sh \ + -v $(pwd)/build/scripts/generate-secrets.sh:/generate-secrets.sh \ -w / \ --entrypoint bash \ ${REPOSITORY}/drupal:${TAG} -c "/generate-secrets.sh && chown -R `id -u`:`id -g` /secrets" @@ -158,7 +158,7 @@ function main() { if [[ $1 == 'yes' ]]; then docker run --rm -t \ -v $(pwd)/secrets:/secrets \ - -v $(pwd)/scripts/generate-secrets.sh:/generate-secrets.sh \ + -v $(pwd)/build/scripts/generate-secrets.sh:/generate-secrets.sh \ -w / \ --entrypoint bash \ ${REPOSITORY}/drupal:${TAG} -c "/generate-secrets.sh && chown -R `id -u`:`id -g` /secrets" diff --git a/scripts/generate-secrets.sh b/build/scripts/generate-secrets.sh similarity index 95% rename from scripts/generate-secrets.sh rename to build/scripts/generate-secrets.sh index a7ed40abc..56aa48026 100755 --- a/scripts/generate-secrets.sh +++ b/build/scripts/generate-secrets.sh @@ -25,7 +25,7 @@ function random_secret() { function main() { echo "Generating Secrets" - local secret_templates=($(find /secrets/template/* -exec basename {} \;)) + local secret_templates=($(find ../secrets/template/* -exec basename {} \;)) generate_jwt_keys for secret in "${secret_templates[@]}"; do case "${secret}" in diff --git a/sample.Dockerfile b/sample.Dockerfile index eda0904c9..84189363a 100644 --- a/sample.Dockerfile +++ b/sample.Dockerfile @@ -12,4 +12,4 @@ RUN --mount=type=bind,source=codebase,target=/build \ find /var/www/drupal/web/sites -name "settings.php" -exec rm {} \; && \ chown -R nginx:nginx /var/www/drupal -COPY rootfs / +COPY build/rootfs / From c199f008442efe292d11ef509f483e29a94ee95b Mon Sep 17 00:00:00 2001 From: Thomas Misilo Date: Wed, 9 Feb 2022 13:38:22 -0600 Subject: [PATCH 3/4] Make the Dockerfile a multistage build I couldn't get the RUN command to run on Mac OS, it kept seeing `/build` as a directory that didn't exist. This commit changes it to be a mutlistage build and copies the codebase directory into the container, after all the runtime configuration is removed as before. --- sample.Dockerfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sample.Dockerfile b/sample.Dockerfile index 84189363a..c5a536b00 100644 --- a/sample.Dockerfile +++ b/sample.Dockerfile @@ -1,15 +1,20 @@ # syntax=docker/dockerfile:experimental ARG REPOSITORY=islandora ARG TAG=latest -FROM ${REPOSITORY}/drupal:${TAG} +FROM ${REPOSITORY}/drupal:${TAG} as step1 + +COPY codebase /build + # Remove runtime configuration and data (files, settings.php, etc) these will # either be mounted as volumes or generated on startup from environment variables. -RUN --mount=type=bind,source=codebase,target=/build \ - cp -r /build/* /var/www/drupal && \ +RUN cp -r /build/* /var/www/drupal && \ rm -fr /var/www/drupal/web/sites/default/files/* && \ bash -lc "remove_standard_profile_references_from_config" && \ find /var/www/drupal/web/sites -name "settings.php" -exec rm {} \; && \ chown -R nginx:nginx /var/www/drupal +FROM ${REPOSITORY}/drupal:${TAG} as application +COPY --from=step1 --chown=nginx:nginx /var/www/drupal /var/www/drupal + COPY build/rootfs / From 46f7621e3fab1d7ca4d58dcca878a4af999d5fb3 Mon Sep 17 00:00:00 2001 From: Thomas Misilo Date: Wed, 9 Feb 2022 13:53:52 -0600 Subject: [PATCH 4/4] Adding `docker-compose.override.yml` to .gitignore `docker-compose.override.yml` is the standard file for overriding docker-compose.yml for specific system usage. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c21c645b2..a0a3ed18b 100644 --- a/.gitignore +++ b/.gitignore @@ -83,6 +83,7 @@ docker-compose.yml #=================== # User overrides for environment variables. docker-compose.env.yml +docker-compose.override.yml #=================== # User overrides for building custom image from the codebase directory.