From 942c3687c11804d96b3b719caeb511ac191c74c4 Mon Sep 17 00:00:00 2001 From: Taku Amano Date: Wed, 7 Jan 2026 22:00:18 +0900 Subject: [PATCH 1/4] Changed mt-config.cgi to mount /etc/mt/mt-config.cgi. --- mt/common.yml | 8 ++++++-- mt/httpd/build-script/apache2.sh | 2 +- mt/mt/build-script/apache2.sh | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mt/common.yml b/mt/common.yml index 8def479..dd1fbef 100644 --- a/mt/common.yml +++ b/mt/common.yml @@ -16,10 +16,12 @@ services: DOCKER_MT_CPANFILES: ${DOCKER_MT_CPANFILES} APACHE_LOG_DIR: ${APACHE_LOG_DIR:-/tmp/apache2/log} APACHE_PID_FILE: ${APACHE_PID_FILE:-/tmp/apache2/run/apache2.pid} + MT_HOME: /var/www/cgi-bin/mt + MT_CONFIG: ${MT_CONFIG_CGI_DEST_PATH:-/etc/mt/mt-config.cgi} volumes: - "..:/mt-dev" - "${MT_HOME_PATH:-../../movabletype}:/var/www/cgi-bin/mt:${DOCKER_VOLUME_MOUNT_FLAG:-rw}" - - "${MT_CONFIG_CGI_SRC_PATH:-../mt-config.cgi-original}:${MT_CONFIG_CGI_DEST_PATH:-/var/www/cgi-bin/mt/mt-config.cgi}:${DOCKER_VOLUME_MOUNT_FLAG:-rw}" + - "${MT_CONFIG_CGI_SRC_PATH:-../mt-config.cgi-original}:${MT_CONFIG_CGI_DEST_PATH:-/etc/mt/mt-config.cgi}:${DOCKER_VOLUME_MOUNT_FLAG:-rw}" - "${BASE_SITE_PATH:-site}:/var/www/html:${DOCKER_VOLUME_MOUNT_FLAG:-rw}" - "support:/var/www/cgi-bin/mt/mt-static/support:${DOCKER_VOLUME_MOUNT_FLAG:-rw}" # override entrypoint @@ -39,10 +41,12 @@ services: NLS_LANG: ${NLS_LANG:-Japanese_Japan.UTF8} APACHE_LOG_DIR: ${APACHE_LOG_DIR:-/tmp/apache2/log} APACHE_PID_FILE: ${APACHE_PID_FILE:-/tmp/apache2/run/apache2.pid} + MT_HOME: /var/www/cgi-bin/mt + MT_CONFIG: ${MT_CONFIG_CGI_DEST_PATH:-/etc/mt/mt-config.cgi} volumes: - "..:/mt-dev" - "${MT_HOME_PATH:-../../movabletype}:/var/www/cgi-bin/mt:${DOCKER_VOLUME_MOUNT_FLAG:-rw}" - - "${MT_CONFIG_CGI_SRC_PATH:-../mt-config.cgi-original}:${MT_CONFIG_CGI_DEST_PATH:-/var/www/cgi-bin/mt/mt-config.cgi}:${DOCKER_VOLUME_MOUNT_FLAG:-rw}" + - "${MT_CONFIG_CGI_SRC_PATH:-../mt-config.cgi-original}:${MT_CONFIG_CGI_DEST_PATH:-/etc/mt/mt-config.cgi}:${DOCKER_VOLUME_MOUNT_FLAG:-rw}" - "${BASE_SITE_PATH:-site}:/var/www/html:${DOCKER_VOLUME_MOUNT_FLAG:-rw}" - "support:/var/www/cgi-bin/mt/mt-static/support:${DOCKER_VOLUME_MOUNT_FLAG:-rw}" # override entrypoint diff --git a/mt/httpd/build-script/apache2.sh b/mt/httpd/build-script/apache2.sh index 68d97cf..a4c387a 100755 --- a/mt/httpd/build-script/apache2.sh +++ b/mt/httpd/build-script/apache2.sh @@ -65,6 +65,6 @@ mod_env_so=`find $module_dirs -name 'mod_env.so' 2>/dev/null | head -1` if [ -n "$mod_env_so" ]; then cat > $httpd_conf_d/mt-env.conf </dev/null | head -1` if [ -n "$mod_env_so" ]; then cat > $httpd_conf_d/mt-env.conf < Date: Wed, 7 Jan 2026 22:05:10 +0900 Subject: [PATCH 2/4] Enable to skip bind-mounting files via BIND_MOUNT_DIRECTORIES_ONLY env variable --- Makefile | 4 +++- bin/setup-environment | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 32f8040..6bc7eaa 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ export MT_HOME_PATH:=${MAKEFILE_DIR}/../movabletype export HTTPD_HOST_NAME:=localhost export HTTPD_EXPOSE_PORT:=80 export UPDATE_BRANCH:=yes +export BIND_MOUNT_DIRECTORIES_ONLY:=no export UPDATE_DOCKER_IMAGE:=yes export CREATE_DATABASE_IF_NOT_EXISTS:=yes export DOCKER_MT_CPANFILES:=t/cpanfile @@ -120,6 +121,7 @@ up-cgi: MT_RUN_VIA=cgi up-cgi: up-common up-psgi: MT_RUN_VIA=psgi +up-psgi: BIND_MOUNT_DIRECTORIES_ONLY:=yes up-psgi: up-common @@ -141,7 +143,7 @@ ifeq (${RECIPE},) endif endif - $(eval export _ARGS=$(shell UPDATE_BRANCH=${UPDATE_BRANCH} ${MAKEFILE_DIR}/bin/setup-environment --recipe "$(shell echo ${RECIPE} | tr ',' ' ')" --repo "$(shell echo ${REPO} | tr ',' ' ')" --pr "$(shell echo ${PR} | tr ',' ' ')" --archive "$(shell echo ${ARCHIVE_FOR_SETUP} | tr ',' ' ')")) + $(eval export _ARGS=$(shell UPDATE_BRANCH=${UPDATE_BRANCH} BIND_MOUNT_DIRECTORIES_ONLY=${BIND_MOUNT_DIRECTORIES_ONLY} ${MAKEFILE_DIR}/bin/setup-environment --recipe "$(shell echo ${RECIPE} | tr ',' ' ')" --repo "$(shell echo ${REPO} | tr ',' ' ')" --pr "$(shell echo ${PR} | tr ',' ' ')" --archive "$(shell echo ${ARCHIVE_FOR_SETUP} | tr ',' ' ')")) ifneq (${RECIPE},) @perl -e 'exit(length($$ENV{_ARGS}) > 0 ? 0 : 1)' endif diff --git a/bin/setup-environment b/bin/setup-environment index ed4f23a..fb29da2 100755 --- a/bin/setup-environment +++ b/bin/setup-environment @@ -211,6 +211,9 @@ sub handle_recipe { } for my $l (@$links) { + next + if $ENV{BIND_MOUNT_DIRECTORIES_ONLY} eq 'yes' + && !-d "$plugin_dir/$l"; push @volumes, " - '$plugin_dir/$l:/var/www/cgi-bin/mt/$l:\${DOCKER_VOLUME_MOUNT_FLAG:-rw}'"; } From 877aa2419eebdd6c2d85aece73b81076e71e508a Mon Sep 17 00:00:00 2001 From: Taku Amano Date: Wed, 7 Jan 2026 22:06:18 +0900 Subject: [PATCH 3/4] Instead of using .htaccess, we have changed it to be embedded in the configuration file when building the image. --- mt/cgi-bin-mt.htaccess | 5 ----- mt/common.yml | 3 --- mt/httpd/build-script/apache2.sh | 11 +++++++++++ 3 files changed, 11 insertions(+), 8 deletions(-) delete mode 100644 mt/cgi-bin-mt.htaccess diff --git a/mt/cgi-bin-mt.htaccess b/mt/cgi-bin-mt.htaccess deleted file mode 100644 index 0e286c7..0000000 --- a/mt/cgi-bin-mt.htaccess +++ /dev/null @@ -1,5 +0,0 @@ -Options +SymLinksIfOwnerMatch - -RewriteEngine on -RewriteRule ^mt-static - [L] -RewriteRule (.*) http://mt/cgi-bin/mt/$1 [P,L] diff --git a/mt/common.yml b/mt/common.yml index dd1fbef..fd56a4b 100644 --- a/mt/common.yml +++ b/mt/common.yml @@ -51,9 +51,6 @@ services: - "support:/var/www/cgi-bin/mt/mt-static/support:${DOCKER_VOLUME_MOUNT_FLAG:-rw}" # override entrypoint - "./docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh" - # proxy setting - - "./cgi-bin-mt.htaccess:/var/www/html/cgi-bin/mt/.htaccess" - - "./cgi-bin-mt.htaccess:/var/www/cgi-bin/mt/.htaccess" ports: - "${HTTPD_EXPOSE_PORT:-80}:80" command: apache2-foreground diff --git a/mt/httpd/build-script/apache2.sh b/mt/httpd/build-script/apache2.sh index a4c387a..cc86411 100755 --- a/mt/httpd/build-script/apache2.sh +++ b/mt/httpd/build-script/apache2.sh @@ -17,6 +17,17 @@ Alias /mt-static/ /var/www/cgi-bin/mt/mt-static/ # Workaround to run amd64 image on arm64 Mutex posixsem CONF +for d in /var/www/html/cgi-bin/mt /var/www/cgi-bin/mt; do + cat >> $httpd_conf_d/mt.conf < +Options +SymLinksIfOwnerMatch + +RewriteEngine on +RewriteRule ^mt-static - [L] +RewriteRule (.*) http://mt/cgi-bin/mt/\$1 [P,L] + +CONF +done mod_rewrite_so=`find $module_dirs -name 'mod_rewrite.so' 2>/dev/null | head -1` if [ -n "$mod_rewrite_so" ]; then From c013dfdaccb2752ddbc3b8ae8af1c8aea85ca56b Mon Sep 17 00:00:00 2001 From: Taku Amano Date: Wed, 7 Jan 2026 22:11:55 +0900 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 481f393..e53d3b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * If the given URL is http://github.com/... and returns 404, then try to download the archive with the `gh` command and try to download the archive at http://github.com/... * Allow starman's --user option to be specified in the MT_UID environment variable. +* Changed to not bind mount files whenever possible. This is because bind mounting files on Docker Desktop on Mac causes an error. ## [2.8.0] - 2025-04-23