diff --git a/.github/workflows/docker-compose-publish.yml b/.github/workflows/docker-compose-publish.yml index 9a74eb5..fd98630 100644 --- a/.github/workflows/docker-compose-publish.yml +++ b/.github/workflows/docker-compose-publish.yml @@ -26,36 +26,14 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Docker meta - id: meta - uses: docker/metadata-action@v3 - with: - # list of Docker images to use as base name for tags - images: | - ${{ github.repository }}_app1 - ${{ github.repository }}_app2 - ${{ env.REGISTRY }}/${{ github.repository }}_app1 - ${{ env.REGISTRY }}/${{ github.repository }}_app2 - # generate Docker tags based on the following events/attributes - tags: | - type=schedule - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha - - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- +# - name: Cache Docker layers +# uses: actions/cache@v2 +# with: +# path: /tmp/.buildx-cache +# key: ${{ runner.os }}-buildx-${{ github.sha }} +# restore-keys: | +# ${{ runner.os }}-buildx- - # Login against a Docker registry except on PR - # https://github.com/docker/login-action - name: Login to GitHub Container Registry if: github.event_name != 'pull_request' uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c @@ -64,38 +42,37 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - # TODO: pull - - name: docker/build-push-action - uses: docker/build-push-action@v2 - with: - context: ./app1 - file: ./app1/Dockerfile - push: true - builder: ${{ steps.buildx.outputs.name }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new +# - name: docker/build-push-action +# uses: docker/build-push-action@v2 +# with: +# context: ./app1 +# file: ./app1/Dockerfile +# push: true +# builder: ${{ steps.buildx.outputs.name }} +# tags: ${{ steps.meta.outputs.tags }} +# labels: ${{ steps.meta.outputs.labels }} +# cache-from: type=local,src=/tmp/.buildx-cache +# cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new +# +# - name: docker/build-push-action +# uses: docker/build-push-action@v2 +# with: +# context: ./app2 +# file: ./app2/Dockerfile +# push: true +# builder: ${{ steps.buildx.outputs.name }} +# tags: ${{ steps.meta.outputs.tags }} +# labels: ${{ steps.meta.outputs.labels }} +# cache-from: type=local,src=/tmp/.buildx-cache +# cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new - - name: docker/build-push-action - uses: docker/build-push-action@v2 - with: - context: ./app2 - file: ./app2/Dockerfile - push: true - builder: ${{ steps.buildx.outputs.name }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new + - name: Build the stack + run: docker-compose build -# - name: Build the stack -# run: docker-compose build --pull --build-arg BUILDKIT_INLINE_CACHE=1 -# -# - name: Push the stack -# run: docker-compose push + - name: Push the stack + run: docker-compose push - - name: Move cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache +# - name: Move cache +# run: | +# rm -rf /tmp/.buildx-cache +# mv /tmp/.buildx-cache-new /tmp/.buildx-cache diff --git a/docker-compose.yml b/docker-compose.yml index 20e731a..eda4278 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,10 @@ version: "3.9" services: app1: - build: app1 + build: + context: ./app1 + cache_from: + - ghcr.io/cyanofresh/docker-compose-ga-cache-example_app1 image: ghcr.io/cyanofresh/docker-compose-ga-cache-example_app1 ports: - "3000:3000" @@ -10,7 +13,10 @@ services: NODE_ENV: production PORT: 3000 app2: - build: app2 + build: + context: ./app2 + cache_from: + - ghcr.io/cyanofresh/docker-compose-ga-cache-example_app2 image: ghcr.io/cyanofresh/docker-compose-ga-cache-example_app2 ports: - "4000:4000"