Skip to content

Commit

Permalink
feat(tag) switch tag to github sha
Browse files Browse the repository at this point in the history
  • Loading branch information
CardinPatson committed Oct 31, 2023
1 parent 48ddf36 commit b74444c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/composite/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -34,24 +34,31 @@ 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 }}
shell: bash
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
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 }}
1 change: 1 addition & 0 deletions .github/workflows/multi-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
paths:
- multicontainer-k8s/client
- .github/workflows/multi-client.yml
- .github/workflows/composite/action.yml

env:
SERVICE: client
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/multi-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
paths:
- multicontainer-k8s/server
- .github/workflows/multi-server.yml
- .github/workflows/composite/action.yml

env:
SERVICE: server
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/multi-worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
paths:
- multicontainer-k8s/worker
- .github/workflows/multi-worker.yml
- .github/workflows/composite/action.yml

env:
SERVICE: worker
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions multicontainer-k8s/deploy.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b74444c

Please sign in to comment.