From 49241f56144335f5ac27690c819837f8fe2bb444 Mon Sep 17 00:00:00 2001 From: Chris <15677803+c00ldude1oo@users.noreply.github.com> Date: Wed, 11 May 2022 18:49:45 -0400 Subject: [PATCH 1/8] Change to alpine base image --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ca782c441..d59093471 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,2 @@ -FROM nginx:1.21.6 -COPY ./out /usr/share/nginx/html \ No newline at end of file +FROM nginx:alpine +COPY ./out /usr/share/nginx/html From 3db65dbb1f1ca27b36d3ca08077c7444d3feae21 Mon Sep 17 00:00:00 2001 From: Chris <15677803+c00ldude1oo@users.noreply.github.com> Date: Wed, 11 May 2022 23:59:09 -0400 Subject: [PATCH 2/8] Update docker.yml Add cache for yarn and nextjs. `yarn install` takes about 25s off `yarn export` takes about 40s --- .github/workflows/docker.yml | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 846055bdb..9bd9c872f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -15,11 +15,35 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/setup-node@v3 - - uses: actions/checkout@v3 + - name: Setup + uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v3 + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Yarn cache + uses: actions/cache@v3 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: ${{ runner.os }}-yarn- + - name: Nextjs cache + uses: actions/cache@v2 + with: + # See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node + path: | + ~/.npm + ${{ github.workspace }}/.next/cache + # Generate a new cache whenever packages or source files change. + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} + # If source files changed but packages didn't, rebuild from a prior cache. + restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- - run: yarn install --frozen-lockfile - run: yarn export - - uses: actions/cache@v2 + - name: Cache build output + uses: actions/cache@v2 id: restore-build with: path: ./out/ From 1f6b2756c49b36f3edf56c9aebf72eb5e7fc6663 Mon Sep 17 00:00:00 2001 From: Chris <15677803+c00ldude1oo@users.noreply.github.com> Date: Thu, 12 May 2022 02:05:59 -0400 Subject: [PATCH 3/8] Revert "Change to alpine base image" This reverts commit 49241f56144335f5ac27690c819837f8fe2bb444. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d59093471..ca782c441 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,2 @@ -FROM nginx:alpine -COPY ./out /usr/share/nginx/html +FROM nginx:1.21.6 +COPY ./out /usr/share/nginx/html \ No newline at end of file From bdb9711c19f3c926567bb3496d81cba37840c9c5 Mon Sep 17 00:00:00 2001 From: Chris <15677803+c00ldude1oo@users.noreply.github.com> Date: Thu, 12 May 2022 02:18:37 -0400 Subject: [PATCH 4/8] Change nginx base to alpine Changed nginx to use alpine instead of debian/ubuntu Image size is 93MB smaller and build time is shorter. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ca782c441..d59093471 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,2 @@ -FROM nginx:1.21.6 -COPY ./out /usr/share/nginx/html \ No newline at end of file +FROM nginx:alpine +COPY ./out /usr/share/nginx/html From 91a6b6972a50a95bc60d5a5668bf4bd37ce121ed Mon Sep 17 00:00:00 2001 From: Aj - Thomas <49837342+ajnart@users.noreply.github.com> Date: Thu, 12 May 2022 09:44:51 +0200 Subject: [PATCH 5/8] Update docker.yml --- .github/workflows/docker.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9bd9c872f..591a17f71 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -104,5 +104,9 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v7 context: . push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} + tags: | + # set latest tag for default branch + type=raw,value=latest,enable={{is_default_branch}} + # minimal + type=pep440,pattern={{version}} labels: ${{ steps.meta.outputs.labels }} From 07869ae3ed8e4acfb67ec9ab0f8e1a7dc0f1d349 Mon Sep 17 00:00:00 2001 From: Aj - Thomas <49837342+ajnart@users.noreply.github.com> Date: Thu, 12 May 2022 09:49:12 +0200 Subject: [PATCH 6/8] Update docker.yml --- .github/workflows/docker.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 591a17f71..89b6c6a9e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -105,8 +105,6 @@ jobs: context: . push: ${{ github.event_name != 'pull_request' }} tags: | - # set latest tag for default branch type=raw,value=latest,enable={{is_default_branch}} - # minimal type=pep440,pattern={{version}} labels: ${{ steps.meta.outputs.labels }} From 0b34abc7d59396055bed2eb3a0363f6b52066ec6 Mon Sep 17 00:00:00 2001 From: Aj - Thomas <49837342+ajnart@users.noreply.github.com> Date: Thu, 12 May 2022 09:56:05 +0200 Subject: [PATCH 7/8] Update docker.yml --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 89b6c6a9e..1a2a4b9a6 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -105,6 +105,6 @@ jobs: context: . push: ${{ github.event_name != 'pull_request' }} tags: | - type=raw,value=latest,enable={{is_default_branch}} - type=pep440,pattern={{version}} + type=raw,value=latest,enable={{is_default_branch}} + type=pep440,pattern={{version}} labels: ${{ steps.meta.outputs.labels }} From 8ae8cb7d5a95418549f78fdb7a66dae428afeee0 Mon Sep 17 00:00:00 2001 From: Aj - Thomas Date: Thu, 12 May 2022 10:04:05 +0200 Subject: [PATCH 8/8] Trying to fix CI tags --- .github/workflows/docker.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1a2a4b9a6..673115419 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -73,13 +73,8 @@ jobs: ghcr.io/ajnart/mhp # 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 + type=raw,value=latest,enable={{is_default_branch}} + type=pep440,pattern={{version}} - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx @@ -104,7 +99,5 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v7 context: . push: ${{ github.event_name != 'pull_request' }} - tags: | - type=raw,value=latest,enable={{is_default_branch}} - type=pep440,pattern={{version}} + tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}