diff --git a/.github/workflows/cached.yml b/.github/workflows/cached.yml new file mode 100644 index 0000000..768b0bd --- /dev/null +++ b/.github/workflows/cached.yml @@ -0,0 +1,40 @@ +name: [Cached] Docker Build & Push on release + +on: + release: + types: [published] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} +# DOCKER_BUILDKIT: 1 +# COMPOSE_DOCKER_CLI_BUILD: 1 + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v1 + + - name: Login to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build the stack + run: docker-compose build + + - name: Push the stack + run: docker-compose push diff --git a/.github/workflows/docker-compose-publish.yml b/.github/workflows/docker-compose-publish.yml deleted file mode 100644 index 9c777b9..0000000 --- a/.github/workflows/docker-compose-publish.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: Docker Build & Push on release - -on: - release: - types: [published] - -env: - REGISTRY: ghcr.io - # github.repository as / - IMAGE_NAME: ${{ github.repository }} - DOCKER_BUILDKIT: 1 - COMPOSE_DOCKER_CLI_BUILD: 1 - -jobs: - build: - - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - -# - 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: Login to GitHub Container Registry - if: github.event_name != 'pull_request' - uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - -# - 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: Build the stack - run: docker-compose build --build-arg BUILDKIT_INLINE_CACHE=1 - - - 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 diff --git a/.github/workflows/not-cached.yml b/.github/workflows/not-cached.yml new file mode 100644 index 0000000..e60dc43 --- /dev/null +++ b/.github/workflows/not-cached.yml @@ -0,0 +1,40 @@ +name: [Not Cached] Docker Build & Push on release + +on: + release: + types: [published] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + DOCKER_BUILDKIT: 1 + COMPOSE_DOCKER_CLI_BUILD: 1 + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build the stack + run: docker-compose build --build-arg BUILDKIT_INLINE_CACHE=1 + + - name: Push the stack + run: docker-compose push