-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathaction.yaml
More file actions
59 lines (53 loc) · 1.72 KB
/
action.yaml
File metadata and controls
59 lines (53 loc) · 1.72 KB
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
name: Insights docker image builder
description: Builds and pushes insights docker image with caching
inputs:
app-env:
description: The APP_ENV to pass as a build argument
required: false
default: production
dockerfile:
description: Path to the Dockerfile
required: true
image-name:
description: Image name (e.g. insights-app, package-downloads-worker)
required: true
build-args:
description: Extra build args (newline-separated KEY=VALUE)
required: false
default: ''
outputs:
image:
description: Image that was built
value: ${{ steps.tag-generator.outputs.IMAGE_TAG }}
runs:
using: composite
steps:
- name: Generate image tag
shell: bash
id: tag-generator
run: |
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-6)
IMAGE_VERSION="${SHORT_SHA}.${{ github.run_attempt }}"
IMAGE_TAG="sjc.ocir.io/axbydjxa5zuh/${{ inputs.image-name }}:${IMAGE_VERSION}"
echo "IMAGE_VERSION=${IMAGE_VERSION}" >> $GITHUB_OUTPUT
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Oracle Container Registry
uses: docker/login-action@v3
with:
registry: sjc.ocir.io
username: ${{ env.ORACLE_DOCKER_USERNAME }}
password: ${{ env.ORACLE_DOCKER_PASSWORD }}
- name: Build and push docker image
uses: docker/build-push-action@v6
with:
context: .
file: ${{ inputs.dockerfile }}
push: true
tags: ${{ steps.tag-generator.outputs.IMAGE_TAG }}
build-args: |
APP_ENV=${{ inputs.app-env }}
${{ inputs.build-args }}
no-cache: true
provenance: false