https://github.com/vukanac/dynamic-docker-compose-base-image
Demo: Dynamicaly configure what base image version will be used for running a script (eg. Testing code agains multiple PHP versions)
https://github.com/vukanac/dynamic-docker-compose-base-image
Last synced: 2 months ago
JSON representation
Demo: Dynamicaly configure what base image version will be used for running a script (eg. Testing code agains multiple PHP versions)
- Host: GitHub
- URL: https://github.com/vukanac/dynamic-docker-compose-base-image
- Owner: vukanac
- Created: 2022-08-26T01:28:08.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-08-26T18:45:52.000Z (almost 3 years ago)
- Last Synced: 2025-02-10T15:17:45.054Z (4 months ago)
- Language: Makefile
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dynamic base image
Pass ARG from Makefile trought docker-compose to Dockerfile.
```shell
$ make show PHP_VERSION=7.4 && make show PHP_VERSION=8.1
...
PHP 7.4.30 (cli) (built: Aug 23 2022 15:21:20) ( NTS )
...
PHP 8.1.9 (cli) (built: Aug 23 2022 13:59:34) (NTS)
...
```## Docker build the latest version
```shell
$ make direct
docker build -t container_tag:latest --build-arg PHP_VERSION=latest .
...
docker run container_tag:latest php -v
PHP 8.1.9 (cli) (built: Aug 23 2022 13:59:34) (NTS)
...
```## Docker build a specific version
```shell
$ make direct PHP_VERSION=7.4
docker build -t container_tag:latest --build-arg PHP_VERSION=latest .
...
docker run container_tag:7.4 php -v
PHP 7.4.30 (cli) (built: Aug 23 2022 15:21:20) ( NTS )
...
```