-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
76 lines (71 loc) · 2.35 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: "Docker Build and Push Dev Images"
description: "Builds the Docker image and pushes it to the specified registry"
inputs:
registry:
description: "Registry's host"
required: false
default: "ghcr.io"
user:
description: "Registry's user"
required: false
default: ${{ github.actor }}
password:
description: "Registry user's password or token"
required: true
image:
description: "Docker image name without tag"
required: true
dockerfile:
description: "Path to the Docker file"
required: false
default: "./Dockerfile"
tag:
description: "Docker image tag"
required: true
build_args:
description: "Environment variables passed to docker build"
required: false
extra_tags:
description: "Additional tags, needs the full version of tags with image name"
required: false
platforms:
description: "The target platforms to build docker containers for"
required: false
default: "linux/arm64, linux/amd64"
runs:
using: "composite"
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-central-1
role-to-assume: arn:aws:iam::907019612533:role/github-ci-docker-cache
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: image=moby/buildkit:master
- name: Log in to the Registry
uses: docker/login-action@v2
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.user }}
password: ${{ inputs.password }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ inputs.image }}
- name: Build and push prod image
uses: docker/build-push-action@v4
with:
file: ${{ inputs.dockerfile }}
context: ${{ github.workspace }}
platforms: ${{ inputs.platforms }}
push: true
build-args: ${{ inputs.build_args }}
tags: |
${{ inputs.image }}:${{ inputs.tag }}
${{ inputs.extra_tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=s3,region=eu-central-1,bucket=gutss3dockercache,name=${{ inputs.image }}:${{ inputs.tag }}
cache-to: type=s3,region=eu-central-1,bucket=gutss3dockercache,name=${{ inputs.image }}:${{ inputs.tag }}