Skip to content

Provide defaults for key args in the Dockerfile #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
freephile opened this issue Feb 13, 2025 · 4 comments
Open

Provide defaults for key args in the Dockerfile #12

freephile opened this issue Feb 13, 2025 · 4 comments

Comments

@freephile
Copy link

Warning

WARN: InvalidDefaultArgInFrom: Default value for ARG gesinn/mediawiki-ci:${MW_VERSION}-php${PHP_VERSION} results in empty or invalid base image name (line 3)

This warning was seen when running make targets from a Semantic MediaWiki checkout - even with an .env file such as below:

# local private overrides for https://github.com/gesinn-it-pub/docker-compose-ci

MW_VERSION=1.43
# list of PHP extensions to install
# PHP_EXTENSIONS="gd mysqli opcache pcntl pdo_mysql xml"
# list of OS packages to install (needed for gd extension)
# OS_PACKAGES="git"
PHP_VERSION=8.1
# DB_TYPE=mysql
# DB_IMAGE="mariadb:10"

# # extensions
# SMW_VERSION=dev-master
# SCRIBUNTO_VERSION=REL1_43

# # Enables "composer update" inside of extension
# COMPOSER_EXT=true

Maybe I did something wrong - because clearly the Semantic MediaWiki Makefile includes .env on line 1 AND goes on to declare and set defaults for the Make variables (which have lower precedence / are supposed to be overridden by .env)

This issue proposes to add default values to the docker-compose-ci Dockerfile variables MW_VERSION and PHP_VERSION on lines 1 and 2 to avoid any warning.

However, this proposal may not be desirable for several reasons:

  1. The issue needs to be confirmed; and perhaps is not reproducible.
  2. There are defaults already in the Makefile, and are assumed to pass to the Dockerfile under normal circumstances.
  3. Developer/Testers should expect to run their builds locally using an .env file or using a CLI override such as make MW_VERSION=1.43 PHP_VERSION=8.2 ci and not be interested in building with a "default" image that only gets stale quickly.

If this issue in not reproducible; or is not desirable, please close it.

@freephile freephile changed the title Provide defaults for key args in the Makefile Provide defaults for key args in the Dockerfile Feb 13, 2025
@gesinn-it-gea
Copy link
Contributor

The docker-compose-ci repository is to be integrated into other repositories as a Git submodule. It uses "Make" as main entry point and command line interface. The Makefile contained in this repository must be called up from a Makefile in the other repository.

@freephile
Copy link
Author

The docker-compose-ci repository is to be integrated into other repositories as a Git submodule. It uses "Make" as main entry point and command line interface. The Makefile contained in this repository must be called up from a Makefile in the other repository.

Acknowledged, and understood.

However, I'm saying that when called from a proper clone of a repo such as the Semantic MediaWiki extension, after executing the following commands:

git submodule init
git submodule update
git submodule update --init --remote
make ci

you get this warning in the initial output:

=> WARN: InvalidDefaultArgInFrom: Default value for ARG gesinn/mediawiki-ci:${MW_VERSION}-php${PHP_VERSION} results in empty or invalid base image name (line 3)

Perhaps there should be defaults added to the Dockerfile?

Or

Maybe it just doesn't matter, and we don't want to disturb the image layer caching for no reason.

The image tag that gets pulled with the warning is semanticmediawiki:test-1.43-
and the container image has this signature
"Image": "sha256:c373ddbf81c4d94753cd1a47951b2a5baa5aded1908c20d6612aad0d4ded8d46"

@gesinn-it-gea
Copy link
Contributor

I get:

 => [wiki internal] load build definition from Dockerfile                                                                                              0.0s
 => => transferring dockerfile: 4.48kB                                                                                                                 0.0s
 => [wiki internal] load metadata for docker.io/gesinn/mediawiki-ci:1.39-php8.1                                                                        1.4s
 => [wiki internal] load .dockerignore                                                                                                                 0.0s
 => => transferring context: 2B                                                                                                                        0.0s
 => CACHED [wiki  1/23] FROM docker.io/gesinn/mediawiki-ci:1.39-php8.1@sha256:aa9419fc7d4bab9e4d8d885eda89973383c751ef81b6cf4e6a6a92a1bacd792e         0.0s

which is taken from https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/Makefile#L14

Are you running "make ci" in SemanticMediaWiki or SemanticMediaWiki/build?

@freephile
Copy link
Author

I am running make ci from the SemanticMediaWiki directory.

This is part of the output to the console as it is in the initial .build make target. Note the values for MW_VERSION and PHP_VERSION are being set (from .env), but still the WARNING is produced about an invalid base image name.

======= .build ========
AL_VERSION= AR_VERSION= CHAMELEON_VERSION= COMPOSER_EXT=true DB_IMAGE="mariadb:11.2" DB_TYPE=mysql DT_VERSION= EXTENSION=SemanticMediaWiki EXTENSION_FOLDER=/var/www/html/extensions/SemanticMediaWiki IMAGE_NAME=semanticmediawiki:test-1.43-  MAPS_VERSION= LINGO_VERSION= SCRIBUNTO_VERSION= MM_VERSION= MW_INSTALL_PATH=/var/www/html MW_VERSION=1.43 NODE_JS= PF_REPO= PF_VERSION= PHP_EXTENSIONS= OS_PACKAGES= PHP_VERSION=8.1 PS_VERSION= SMW_VERSION= SRF_VERSION=  docker compose -f build/docker-compose.yml -f build/docker-compose-ci.yml  --project-name semanticmediawiki-mysql --profile mysql build --no-cache wiki
[+] Building 0/0
[+] Building 0/1 Building                                                                                                                                                                                                      0.1s 
 ⠼ Service wiki  Building                                                                                                                                                                                                     51.5s 
[+] Building 100.5s (32/32) FINISHED                                                                                                                                                                                 docker:default
 => [wiki internal] load build definition from Dockerfile                                                                                                                                                                      0.0s
 => => transferring dockerfile: 4.97kB                                                                                                                                                                                         0.0s
 => WARN: InvalidDefaultArgInFrom: Default value for ARG gesinn/mediawiki-ci:${MW_VERSION}-php${PHP_VERSION} results in empty or invalid base image name (line 3) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants