Skip to content

Commit 01e5cae

Browse files
authored
build: update Docker workflow & build process (#6094)
* ci: runners to use ubuntu-latest Signed-off-by: Dwi Siswanto <[email protected]> * build: update Docker workflow & build process Signed-off-by: Dwi Siswanto <[email protected]> --------- Signed-off-by: Dwi Siswanto <[email protected]>
1 parent 46c05d2 commit 01e5cae

8 files changed

+45
-57
lines changed

.github/workflows/dockerhub-push.yml

-47
This file was deleted.

.github/workflows/generate-pgo.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
strategy:
2020
matrix:
2121
targets: [150]
22-
runs-on: ubuntu-latest-16-cores
22+
runs-on: ubuntu-latest
2323
if: github.repository == 'projectdiscovery/nuclei'
2424
permissions:
2525
contents: write

.github/workflows/perf-regression.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
perf-regression:
9-
runs-on: ubuntu-latest-16-cores
9+
runs-on: ubuntu-latest
1010
if: github.repository == 'projectdiscovery/nuclei'
1111
env:
1212
BENCH_OUT: "/tmp/bench.out"

.github/workflows/perf-test.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
matrix:
1212
count: [50, 100, 150]
13-
runs-on: ubuntu-latest-16-cores
13+
runs-on: ubuntu-latest
1414
if: github.repository == 'projectdiscovery/nuclei'
1515
env:
1616
LIST_FILE: "/tmp/targets-${{ matrix.count }}.txt"

.github/workflows/release.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ jobs:
1414
with:
1515
fetch-depth: 0
1616
- uses: projectdiscovery/actions/setup/go@v1
17+
- uses: docker/setup-qemu-action@v3
18+
- uses: docker/setup-buildx-action@v3
19+
- uses: docker/login-action@v3
20+
with:
21+
username: ${{ secrets.DOCKER_USERNAME }}
22+
password: ${{ secrets.DOCKER_TOKEN }}
1723
- uses: projectdiscovery/actions/goreleaser@v1
1824
with:
1925
release: true

.goreleaser.yml

+22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
version: 2
2+
13
before:
24
hooks:
35
- go mod download
@@ -44,6 +46,26 @@ archives:
4446
checksum:
4547
algorithm: sha256
4648

49+
dockers:
50+
- image_templates:
51+
- "{{ .ProjectName }}:{{ .Tag }}"
52+
- "{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}"
53+
- "{{ .ProjectName }}:v{{ .Major }}"
54+
- "{{ .ProjectName }}:latest"
55+
dockerfile: Dockerfile.goreleaser
56+
use: buildx
57+
build_flag_templates:
58+
- "--pull"
59+
- "--label=org.opencontainers.image.authors=ProjectDiscovery"
60+
- "--label=org.opencontainers.image.created={{ .Date }}"
61+
- "--label=org.opencontainers.image.description=\"Nuclei is a fast, customizable vulnerability scanner powered by the global security community and built on a simple YAML-based DSL, enabling collaboration to tackle trending vulnerabilities on the internet. It helps you find vulnerabilities in your applications, APIs, networks, DNS, and cloud configurations.\""
62+
- "--label=org.opencontainers.image.licenses=MIT"
63+
- "--label=org.opencontainers.image.ref.name={{ .Tag }}"
64+
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
65+
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
66+
- "--label=org.opencontainers.image.url=https://github.com/projectdiscovery/{{ .ProjectName }}"
67+
- "--label=org.opencontainers.image.version={{ .Version }}"
68+
4769
announce:
4870
slack:
4971
enabled: true

Dockerfile

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# Build
2-
FROM golang:1.22-alpine AS build-env
2+
FROM golang:1.22-alpine AS builder
3+
34
RUN apk add build-base
45
WORKDIR /app
56
COPY . /app
6-
RUN go mod download
7-
RUN go build ./cmd/nuclei
7+
RUN make verify
8+
RUN make build
89

910
# Release
10-
FROM alpine:3.18.6
11-
RUN apk upgrade --no-cache \
12-
&& apk add --no-cache bind-tools chromium ca-certificates
13-
COPY --from=build-env /app/nuclei /usr/local/bin/
11+
FROM alpine:latest
12+
13+
RUN apk add --no-cache bind-tools chromium ca-certificates
14+
COPY --from=builder /app/bin/nuclei /usr/local/bin/
1415

1516
ENTRYPOINT ["nuclei"]

Dockerfile.goreleaser

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM alpine:latest
2+
3+
RUN apk add --no-cache bind-tools chromium ca-certificates
4+
COPY nuclei /usr/local/bin/
5+
6+
ENTRYPOINT ["nuclei"]

0 commit comments

Comments
 (0)