forked from eclipse-kuksa/kuksa.val.services
-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (62 loc) · 2.53 KB
/
dev_container_build.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
# /********************************************************************************
# * Copyright (c) 2022 Contributors to the Eclipse Foundation
# *
# * See the NOTICE file(s) distributed with this work for additional
# * information regarding copyright ownership.
# *
# * This program and the accompanying materials are made available under the
# * terms of the Apache License 2.0 which is available at
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * SPDX-License-Identifier: Apache-2.0
# ********************************************************************************/
name: dev-container-build
on:
push:
paths:
- "tools/Dockerfile"
branches:
- main
workflow_dispatch:
inputs:
tag:
description: "tag of the docker container, eg:latest, v0.2.1"
required: false
default: "latest"
workflow_call:
inputs:
tag:
description: "tag of the docker container, eg:latest, v0.2.1"
type: string
required: false
default: "latest"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: adding github workspace as safe directory
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- uses: actions/checkout@v3
- id: repository-name-adjusted
name: Prepare repository name in lower case for docker upload. This supports repository names in mixed case
uses: ASzc/change-string-case-action@v5
with:
string: ${{ github.repository }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# Runs docker Build
- name: Run docker Build
# github.event.inputs.tag - used when triggered by workflow_dispatch
# inputs.tag - used when triggered by workflow_call
run: |
docker build --build-arg version=latest --build-arg USER_ID=0 --build-arg GROUP_ID=0 -t ghcr.io/${{ steps.repository-name-adjusted.outputs.lowercase }}/oci_kuksa-val-services-ci:${{ github.event.inputs.tag }}${{ inputs.tag }} -f tools/Dockerfile .
# push docker
- name: Push docker
# github.event.inputs.tag - used when triggered by workflow_dispatch
# inputs.tag - used when triggered by workflow_call
run: |
docker push ghcr.io/${{ steps.repository-name-adjusted.outputs.lowercase }}/oci_kuksa-val-services-ci:${{ github.event.inputs.tag }}${{ inputs.tag }}