diff --git a/.github/workflows/composite/action.yml b/.github/workflows/composite/action.yml index 7abc5f3..d9f85b4 100644 --- a/.github/workflows/composite/action.yml +++ b/.github/workflows/composite/action.yml @@ -15,7 +15,7 @@ inputs: description: "registry password" required: true registry_endpoint: - description: "repo registry https://hub.docker.com/u/cardin21" + description: "repo registry docker.io/cardin21" runs: using: "composite" @@ -34,12 +34,19 @@ runs: username: ${{ inputs.registry_username }} password: ${{ inputs.registry_password }} + - name: Set SHA as env variable + run: | + currentsha=$(echo ${GITHUB_SHA##*/}) + echo "running on $currentsha" + echo "SHA=$currentsha" >> $GITHUB_ENV + shell: bash + - name: Compose build ${{ inputs.service }} shell: bash run: sudo -E docker-compose build ${{ inputs.service }} working-directory: ./multicontainer-k8s env: - TAG: latest + TAG: ${{ env.SHA }} REGISTRY: ${{ inputs.registry_endpoints }} - name: Compose push ${{ inputs.service }} @@ -47,11 +54,11 @@ runs: run: sudo -E docker-compose push ${{ inputs.service }} working-directory: ./multicontainer-k8s env: - TAG: latest + TAG: ${{ env.SHA }} REGISTRY: ${{ inputs.registry_endpoint }} - name: Create multiarch manifest shell: bash run: | - docker --config ~/.docker manifest create ${{ inputs.registry_endpoint }}/${{ inputs.image_name }}:latest ${{ inputs.registry_endpoint }}/${{ inputs.image_name }}:linux-latest - docker --config ~/.docker manifest push ${{ inputs.registry_endpoint }}/${{ inputs.image_name }}:latest \ No newline at end of file + docker --config ~/.docker manifest create ${{ inputs.registry_endpoint }}/${{ inputs.image_name }}:${{ env.SHA }} ${{ inputs.registry_endpoint }}/${{ inputs.image_name }}:linux-${{ env.SHA }} + docker --config ~/.docker manifest push ${{ inputs.registry_endpoint }}/${{ inputs.image_name }}:${{ env.SHA }} \ No newline at end of file diff --git a/.github/workflows/multi-client.yml b/.github/workflows/multi-client.yml index b28f540..82892f1 100644 --- a/.github/workflows/multi-client.yml +++ b/.github/workflows/multi-client.yml @@ -8,6 +8,7 @@ on: paths: - multicontainer-k8s/client - .github/workflows/multi-client.yml + - .github/workflows/composite/action.yml env: SERVICE: client diff --git a/.github/workflows/multi-server.yml b/.github/workflows/multi-server.yml index 939d9af..65fd302 100644 --- a/.github/workflows/multi-server.yml +++ b/.github/workflows/multi-server.yml @@ -8,6 +8,7 @@ on: paths: - multicontainer-k8s/server - .github/workflows/multi-server.yml + - .github/workflows/composite/action.yml env: SERVICE: server diff --git a/.github/workflows/multi-worker.yml b/.github/workflows/multi-worker.yml index 0f044d4..84ff292 100644 --- a/.github/workflows/multi-worker.yml +++ b/.github/workflows/multi-worker.yml @@ -9,6 +9,7 @@ on: paths: - multicontainer-k8s/worker - .github/workflows/multi-worker.yml + - .github/workflows/composite/action.yml env: SERVICE: worker diff --git a/.github/workflows/deploy-gke.yml b/.github/workflows/old/gke-deploy.yml.old similarity index 100% rename from .github/workflows/deploy-gke.yml rename to .github/workflows/old/gke-deploy.yml.old diff --git a/multicontainer-k8s/deploy.sh b/multicontainer-k8s/deploy.sh new file mode 100644 index 0000000..4ceb29c --- /dev/null +++ b/multicontainer-k8s/deploy.sh @@ -0,0 +1,9 @@ +docker build -t cardin21/multi-client -f ./client/Dockerfile ./client +docker build -t cardin21/multi-server -f ./server/Dockerfile ./server +docker build -t cardin21/multi-worker -f ./server/Dockerfile ./worker +docker push cardin21/multi-client +docker push cardin21/multi-server +docker push cardin21/multi-worker +kubectl apply -f k8s +kubectl set image deployments/server-deployment server=cardin21/multi-server +#git rev-parse HEAD \ No newline at end of file