-
Notifications
You must be signed in to change notification settings - Fork 131
158 lines (156 loc) · 4.69 KB
/
publish_docker_images.yml
File metadata and controls
158 lines (156 loc) · 4.69 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Publish Docker Images
on:
push:
tags:
- v*.*.*
workflow_dispatch:
inputs:
tag:
description: "Tag to build"
required: true
log_level:
description: "Log level"
required: false
default: "info"
jobs:
image-matrix:
name: Publish Images
runs-on: ubuntu-latest
strategy:
matrix:
include:
# Baseimage
- base: scratch
tag: latest
# Maven: only support lts versions
- base: maven:latest
tag: maven
- base: maven:3-eclipse-temurin-8
tag: maven3-jdk8
- base: maven:3-eclipse-temurin-11
tag: maven3-jdk11
- base: maven:3-eclipse-temurin-17
tag: maven3-jdk17
- base: maven:3-eclipse-temurin-21
tag: maven3-jdk21
# Gradle: only support lts versions
- base: gradle:latest
tag: gradle
- base: gradle:jdk8
tag: gradle-jdk8
- base: gradle:jdk11
tag: gradle-jdk11
- base: gradle:jdk17
tag: gradle-jdk17
- base: gradle:jdk21
tag: gradle-jdk21
# Npm: only support lts versions
- base: node:latest
tag: node
- base: node:14
tag: node14
- base: node:16
tag: node16
- base: node:18
tag: node18
- base: node:20
tag: node20
# php
- base: composer:latest
tag: php
# Ruby
- base: ruby:latest
tag: ruby
- base: ruby:3.3
tag: ruby3.3
- base: ruby:3.2
tag: ruby3.2
- base: ruby:3.1
tag: ruby3.1
- base: ruby:3.0
tag: ruby3.0
- base: ruby:2.7
tag: ruby2.7
# Go
- base: golang:latest
tag: go
- base: golang:1.12
tag: go1.12
- base: golang:1.13
tag: go1.13
- base: golang:1.14
tag: go1.14
- base: golang:1.15
tag: go1.15
- base: golang:1.16
tag: go1.16
- base: golang:1.17
tag: go1.17
- base: golang:1.18
tag: go1.18
- base: golang:1.19
tag: go1.19
- base: golang:1.20
tag: go1.20
- base: golang:1.21
tag: go1.21
- base: golang:1.22
tag: go1.22
# Python: only support lts versions
- base: python:latest
tag: python
- base: python:3.12
tag: python3.12
- base: python:3.11
tag: python3.11
- base: python:3.10
tag: python3.10
- base: python:3.9
tag: python3.9
- base: python:3.8
tag: python3.8
- base: python:2.7
tag: python2.7
# Rust
- base: rust:latest
tag: rust
# Erlang
- base: erlang:latest
tag: erlang
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Make Image Tags
run: |
echo VERSION=$(echo ${GITHUB_REF} | rev | cut -d'/' -f 1 | rev ) >> ${GITHUB_ENV}
echo docker_hub_tag=${{ secrets.DOCKERHUB_USERNAME }}/opensca-cli >> ${GITHUB_ENV}
echo github_package_tag=ghcr.io/${{ github.repository_owner }}/opensca-cli | tr '[:upper:]' '[:lower:]' >> ${GITHUB_ENV}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
VERSION=${{ env.VERSION }}
TAG=${{ matrix.tag }}
BASEIMAGE=${{ matrix.base }}
tags: |
${{ env.docker_hub_tag }}:${{ matrix.tag }}
${{ env.github_package_tag }}:${{ matrix.tag }}