File tree Expand file tree Collapse file tree 3 files changed +30
-11
lines changed Expand file tree Collapse file tree 3 files changed +30
-11
lines changed Original file line number Diff line number Diff line change 1- name : Publish Docker image version
1+ name : Build & Publish
22
33on :
44 workflow_call :
3535 required : true
3636
3737jobs :
38- push_to_registry :
39- name : Push Docker image to Docker Hub
38+ build :
39+ name : Build Docker image
4040 runs-on : ubuntu-latest
4141
4242 permissions :
@@ -99,12 +99,12 @@ jobs:
9999 tags : ${{ steps.meta.outputs.tags }}
100100 labels : ${{ steps.meta.outputs.labels }}
101101
102- push_children :
103- name : Push children Docker image to Docker Hub
102+ build_variations :
103+ name : Build Docker image variation
104104 runs-on : ubuntu-latest
105105
106106 needs :
107- - push_to_registry
107+ - build
108108
109109 strategy :
110110 fail-fast : false
Original file line number Diff line number Diff line change 2525 echo "versions=$(cat config.json | jq . --compact-output)" >> "$GITHUB_OUTPUT"
2626
2727 docker_build_push :
28- name : Docker Build and Push
28+ name : Build and Push
2929 needs :
3030 - setup
3131
Original file line number Diff line number Diff line change 11all : build
22
33IMAGE =lojassimonetti/php-apache-oci8-composer
4- tag =$(shell git branch | grep \* | cut -d ' ' -f2)
5- TAG =$(shell [[ "$(tag ) " == "master" ]] && echo "latest" || echo $(tag ) )
64FILE =Dockerfile
75
6+ list-names :
7+ @cat config.json| jq ' .[]|.name' --raw-output
8+
89build :
9- docker build --file $(FILE ) --pull . -t $(IMAGE ) :$(TAG )
10+ ifndef name
11+ $(error No name was informed throught the "name" parameter)
12+ endif
13+ docker run --rm \
14+ `cat config.json | \
15+ jq '.[]|select(.name == "$(name)")|to_entries|map(select(.key != "variations"))' | \
16+ jq '.|map(" -e DOCKER_BUILD_" + (.key|ascii_upcase) + "=" + (.value|tostring) + "")|.[]' \
17+ --raw-output` \
18+ -v `pwd`:/work -w /work \
19+ webdevops/go-replace:latest \
20+ --mode=template ./`cat config.json | \
21+ jq '.[]|select(.name == "$(name)")|.template|if . == null then "Dockerfile.tmpl" else . end' --raw-output` \
22+ -o Dockerfile
23+ docker build . --pull -t $(IMAGE):$(name)
24+ rm Dockerfile
1025
1126push : build
1227 docker push $(IMAGE ) :$(TAG )
1328
1429build-var :
15- make build TAG=$(TAG ) -$(var ) FILE=$(FILE ) .$(var )
30+ ifndef name
31+ $(error No variation was informed throught the "var" parameter)
32+ endif
33+ make build name=$(name)
34+ docker build --build-arg IMAGE_BASE=$(IMAGE):$(name) --file Dockerfile.$(var) -t $(IMAGE):$(name)-$(var) .
1635
1736push-var : build-var
1837 docker push $(IMAGE ) :$(TAG ) -$(var )
You can’t perform that action at this time.
0 commit comments