whoan / docker-build-with-cache-action

:octocat: Build and push docker images caching each stage to reduce build time
MIT License
340 stars 54 forks source link

How to have multi docker build stages #100

Closed genieai-vikas closed 3 years ago

genieai-vikas commented 3 years ago

I have this stage.

      - name: Build and Tag Node image
        id: build-ui-image
        env:
          BRANCH_TAG: ${{ steps.extract_branch.outputs.branch }}
          DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
          ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
          ECR_REPOSITORY: app-ui/qa
        run: |
          export DOCKER_BUILDKIT=1
          docker build -t app/root:$BRANCH_TAG .
          docker build -t app/base:$BRANCH_TAG -f ./src/microservices/Dockerfile src/microservices/
          docker build -t image:$BRANCH_TAG -f src/microservices/base/Dockerfile ./src/microservices/ui/
          docker build --target ui-dependency --tag ui-dependency:$BRANCH_TAG --build-arg BRANCH_TAG=$BRANCH_TAG -f src/pre-prod/Dockerfile ./src/microservices/sdui/
          docker build --target ui-app --tag ui-app:$BRANCH_TAG --build-arg BRANCH_TAG=$BRANCH_TAG -f src/Dockerfile ./src/microservices/sdui
          docker push ui-app:$BRANCH_TAG

can we use multi-docker build with whoan/docker-build-with-cache-action?

whoan commented 3 years ago

@genieai-vikas You can try using a docker-compose file or using the action multiple times.