ci: trim down docker main docker image

This commit is contained in:
Ruben Fiszel
2022-11-07 13:37:37 +01:00
parent 7e6aac3ea8
commit 61c915488c
8 changed files with 59 additions and 26 deletions
+32 -7
View File
@@ -26,7 +26,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta local
id: metalocal
id: meta-local
uses: docker/metadata-action@v4
with:
images: ${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}
@@ -43,19 +43,31 @@ jobs:
context: .
push: true
tags: |
${{ steps.metalocal.outputs.tags }}
${{ steps.meta-local.outputs.tags }}
labels: ${{ steps.metalocal.outputs.labels }}
labels: ${{ steps.meta-local.outputs.labels }}
cache-from: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
- name: Docker meta
if: github.event_name != 'pull_request'
id: meta
id: meta-slim
uses: docker/metadata-action@v4
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Docker meta
if: github.event_name != 'pull_request'
id: meta-heavy
uses: docker/metadata-action@v4
with:
images: |
${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
@@ -72,6 +84,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to ECR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.ECR_REGISTRY }}
@@ -86,10 +99,22 @@ jobs:
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta-local.outputs.labels }}
cache-from: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
- name: Build and push publicly
uses: docker/build-push-action@v3
if: github.event_name != 'pull_request'
with:
context: .
push: true
file: ./DockerfileHeavy
tags: |
${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ steps.metalocal.outputs.tags }}
${{ steps.meta.outputs.tags }}
labels: ${{ steps.metalocal.outputs.labels }}
${{ steps.meta-local.outputs.tags }}
${{ steps.meta-heavy.outputs.tags }}
labels: ${{ steps.meta-local.outputs.labels }}
cache-from: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
playwright: