Skip to content

Commit

Permalink
Load built images in docker (OWASP#51)
Browse files Browse the repository at this point in the history
* Seperate build, run and push
  • Loading branch information
piyushroshan authored May 12, 2022
1 parent 1b80ce4 commit f80ad2e
Showing 1 changed file with 84 additions and 15 deletions.
99 changes: 84 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,54 +80,123 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build crapi-identity image and push to Docker Hub
- name: Build crapi-identity image
uses: docker/build-push-action@v2
with:
context: ./services/identity
tags: crapi/crapi-identity:${{ env.TAG_LATEST }},crapi/crapi-identity:${{ env.TAG_NAME }}
push: false
load: true
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build crapi-workshop image
uses: docker/build-push-action@v2
with:
context: ./services/workshop
tags: crapi/crapi-workshop:${{ env.TAG_LATEST }},crapi/crapi-workshop:${{ env.TAG_NAME }}
push: false
load: true
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build crapi-community image
uses: docker/build-push-action@v2
with:
context: ./services/community
tags: crapi/crapi-community:${{ env.TAG_LATEST }},crapi/crapi-community:${{ env.TAG_NAME }}
push: false
load: true
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build crapi-web image
uses: docker/build-push-action@v2
with:
context: ./services/web
tags: crapi/crapi-web:${{ env.TAG_LATEST }},crapi/crapi-web:${{ env.TAG_NAME }}
push: false
load: true
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Check Mailhog existence
id: check_mailhog_exists
uses: andstor/file-existence-action@v1
with:
files: "./services/mailhog"

- name: Build mailhog image
if: steps.check_mailhog_exists.outputs.files_exists == 'true'
uses: docker/build-push-action@v2
with:
context: ./services/mailhog
tags: crapi/mailhog:${{ env.TAG_LATEST }},crapi/mailhog:${{ env.TAG_NAME }}
push: false
load: true
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Show all images built
run: docker images

- name: Env seen
run: env

- name: Build crapi-identity all platforms and conditionally push to Docker Hub
uses: docker/build-push-action@v2
with:
context: ./services/identity
tags: crapi/crapi-identity:${{ env.TAG_LATEST }},crapi/crapi-identity:${{ env.TAG_NAME }}
push: ${{ needs.build-context.outputs.push_image }}
platforms: ${{ env.PLATFORMS }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build crapi-workshop image and push to Docker Hub
- name: Build crapi-workshop all platforms and conditionally push to Docker Hub
uses: docker/build-push-action@v2
with:
context: ./services/workshop
tags: crapi/crapi-workshop:${{ env.TAG_LATEST }},crapi/crapi-workshop:${{ env.TAG_NAME }}
push: ${{ needs.build-context.outputs.push_image }}
platforms: ${{ env.PLATFORMS }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build crapi-community image and push to Docker Hub
- name: Build crapi-community all platforms and conditionally push to Docker Hub
uses: docker/build-push-action@v2
with:
context: ./services/community
tags: crapi/crapi-community:${{ env.TAG_LATEST }},crapi/crapi-community:${{ env.TAG_NAME }}
push: ${{ needs.build-context.outputs.push_image }}
platforms: ${{ env.PLATFORMS }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build crapi-web image and push to Docker Hub
- name: Build crapi-web all platforms and conditionally push to Docker Hub
uses: docker/build-push-action@v2
with:
context: ./services/web
tags: crapi/crapi-web:${{ env.TAG_LATEST }},crapi/crapi-web:${{ env.TAG_NAME }}
push: ${{ needs.build-context.outputs.push_image }}
platforms: ${{ env.PLATFORMS }}
- name: Check Mailhog existence
id: check_mailhog_exists
uses: andstor/file-existence-action@v1
with:
files: "./services/mailhog"
- name: Build mailhog image and push to Docker Hub
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build mailhog all platforms and conditionally push to Docker Hub
if: steps.check_mailhog_exists.outputs.files_exists == 'true'
uses: docker/build-push-action@v2
with:
context: ./services/mailhog
tags: crapi/mailhog:${{ env.TAG_LATEST }},crapi/mailhog:${{ env.TAG_NAME }}
push: ${{ needs.build-context.outputs.push_image }}
platforms: ${{ env.PLATFORMS }}

- name: Env seen
run: env
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Show all images built
run: docker images

0 comments on commit f80ad2e

Please sign in to comment.