Skip to content

Commit 93241ff

Browse files
committed
feat: add package manager support
1 parent 4385230 commit 93241ff

2 files changed

Lines changed: 111 additions & 7 deletions

File tree

.github/workflows/publish_docker_images.yml

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,109 @@ on:
1515
default: "info"
1616

1717
jobs:
18-
publish-images:
18+
image-matrix:
1919
name: Publish Images
2020
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
include:
24+
# Baseimage
25+
- base: scratch
26+
# Maven: only support lts versions
27+
- base: maven:latest
28+
tag: -maven
29+
- base: maven:3-eclipse-temurin-8
30+
tag: -maven3-jdk8
31+
- base: maven:3-eclipse-temurin-11
32+
tag: -maven3-jdk11
33+
- base: maven:3-eclipse-temurin-17
34+
tag: -maven3-jdk17
35+
- base: maven:3-eclipse-temurin-21
36+
tag: -maven3-jdk21
37+
# Gradle: only support lts versions
38+
- base: gradle:latest
39+
tag: -gradle
40+
- base: gradle:jdk8
41+
tag: -gradle-jdk8
42+
- base: gradle:jdk11
43+
tag: -gradle-jdk11
44+
- base: gradle:jdk17
45+
tag: -gradle-jdk17
46+
- base: gradle:jdk21
47+
tag: -gradle-jdk21
48+
# Npm: only support lts versions
49+
- base: node:latest
50+
tag: -node
51+
- base: node:14
52+
tag: -node14
53+
- base: node:16
54+
tag: -node16
55+
- base: node:18
56+
tag: -node18
57+
- base: node:20
58+
tag: -node20
59+
# php
60+
- base: composer:latest
61+
tag: -php
62+
# Ruby
63+
- base: ruby:latest
64+
tag: -ruby
65+
- base: ruby:3.3
66+
tag: -ruby3.3
67+
- base: ruby:3.2
68+
tag: -ruby3.2
69+
- base: ruby:3.1
70+
tag: -ruby3.1
71+
- base: ruby:3.0
72+
tag: -ruby3.0
73+
- base: ruby:2.7
74+
tag: -ruby2.7
75+
# Go
76+
- base: golang:latest
77+
tag: -go
78+
- base: golang:1.12
79+
tag: -go1.12
80+
- base: golang:1.13
81+
tag: -go1.13
82+
- base: golang:1.14
83+
tag: -go1.14
84+
- base: golang:1.15
85+
tag: -go1.15
86+
- base: golang:1.16
87+
tag: -go1.16
88+
- base: golang:1.17
89+
tag: -go1.17
90+
- base: golang:1.18
91+
tag: -go1.18
92+
- base: golang:1.19
93+
tag: -go1.19
94+
- base: golang:1.20
95+
tag: -go1.20
96+
- base: golang:1.21
97+
tag: -go1.21
98+
- base: golang:1.22
99+
tag: -go1.22
100+
# Python: only support lts versions
101+
- base: python:latest
102+
tag: -python
103+
- base: python:3.12
104+
tag: -python3.12
105+
- base: python:3.11
106+
tag: -python3.11
107+
- base: python:3.10
108+
tag: -python3.10
109+
- base: python:3.9
110+
tag: -python3.9
111+
- base: python:3.8
112+
tag: -python3.8
113+
- base: python:2.7
114+
tag: -python2.7
115+
# Rust
116+
- base: rust:latest
117+
tag: -rust
118+
# Erlang
119+
- base: erlang:latest
120+
tag: -erlang
21121
steps:
22122
- name: Checkout
23123
uses: actions/checkout@v4
@@ -50,6 +150,8 @@ jobs:
50150
push: true
51151
build-args: |
52152
VERSION=${{ env.VERSION }}
153+
TAG=${{ matrix.tag }}
154+
BASEIMAGE=${{ matrix.base }}
53155
tags: |
54156
${{ env.docker_hub_tag }}:latest
55157
${{ env.docker_hub_tag }}:${{ env.VERSION }}

docker/Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
FROM golang:latest AS builder
2-
3-
ARG TARGETARCH
41
ARG VERSION
2+
ARG TAG
3+
ARG BASEIMAGE
4+
5+
FROM golang:latest AS builder
56

67
COPY ./ /app
78
WORKDIR /app
8-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \
9-
go build -ldflags "-s -w -X 'main.version=${VERSION}' " \
9+
RUN CGO_ENABLED=0 GOOS=linux \
10+
go build -ldflags "-s -w -X 'main.version=${VERSION}${TAG}' " \
1011
-o /app/opensca-cli main.go
1112

12-
FROM scratch
13+
FROM ${BASEIMAGE}
1314
LABEL authors="OpenSCA Team <opensca@anpro-tech.com>"
1415

1516
COPY --from=builder /app/opensca-cli /app/opensca-cli
17+
COPY --from=builder /app/opensca-cli /app/config.json
1618
WORKDIR /src
1719
ENTRYPOINT [ "/app/opensca-cli"]
1820
CMD ["-path", "/src", "-config", "/src/config.json"]

0 commit comments

Comments
 (0)