Skip to content

Commit 1bc7aaa

Browse files
authored
fix: security build issue (#198)
* ci: trigger security build job in PRs * chore: clean up * fix: sonarqube warnings * fix: issue with copying parts of the source code * chore: nit
1 parent eb0fec8 commit 1bc7aaa

File tree

4 files changed

+32
-18
lines changed

4 files changed

+32
-18
lines changed

.github/workflows/build-docker.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ name: "Build Pipeline (Docker)"
22

33
on:
44
push:
5-
branches:
6-
- jesse/pipeline-deploy
7-
- main
5+
branches: [main]
86

97
env:
108
IMAGE_NAME: "${{ vars.GAR_LOCATION }}-docker.pkg.dev/${{ vars.PROJECT_ID }}/${{ secrets.DOCKER_REPOSITORY }}/polygon-cli"
@@ -55,9 +53,9 @@ jobs:
5553
# run: |-
5654
# export CLOUDSDK_CORE_DISABLE_PROMPTS=1
5755
# gcloud components install beta --quiet
58-
56+
5957
# DIGEST=$(gcloud container images describe ${{ env.IMAGE_NAME }}:${{ github.sha }} --format='get(image_summary.digest)')
60-
58+
6159
# gcloud beta container binauthz attestations sign-and-create \
6260
# --artifact-url="${{ env.IMAGE_NAME }}@${DIGEST}" \
6361
# --attestor="${{ env.ATTESTOR }}" \

.github/workflows/build-package.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ name: "Build Pipeline (Debian)"
22

33
on:
44
push:
5-
branches:
6-
- jesse/pipeline-deploy
7-
- main
5+
branches: [main]
86

97
jobs:
108
build-pipeline-apt:

.github/workflows/security-build.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Security Build
22

33
on:
4+
pull_request:
5+
merge_group:
46
push:
5-
branches:
6-
- main
7-
workflow_dispatch: {}
7+
branches: [main]
88

99
jobs:
1010
sonarqube:

Dockerfile

+25-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
1-
FROM golang:1.21 as builder
2-
WORKDIR /go/src/app
1+
FROM golang:1.21 AS builder
2+
WORKDIR /workspace
33
COPY go.mod go.sum ./
44
RUN go mod download
5-
COPY . .
6-
RUN CGO_ENABLED=0 make build
75

8-
FROM scratch
6+
COPY abi/ abi/
7+
COPY bindings/ bindings/
8+
COPY cmd/ cmd/
9+
COPY dashboard/ dashboard/
10+
COPY gethkeystore/ gethkeystore/
11+
COPY hdwallet/ hdwallet/
12+
COPY metrics/ metrics/
13+
COPY p2p/ p2p/
14+
COPY proto/ proto/
15+
COPY rpctypes/ rpctypes/
16+
COPY util/ util/
17+
COPY main.go ./
18+
RUN CGO_ENABLED=0 go build -o polycli main.go
19+
20+
# Use distroless as minimal base image to package the manager binary
21+
# Refer to https://github.com/GoogleContainerTools/distroless for more details
22+
FROM gcr.io/distroless/static:nonroot
923
WORKDIR /
1024
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
11-
COPY --from=builder /go/src/app/out/polycli /usr/bin/polycli
25+
COPY --from=builder /workspace/polycli /usr/bin/polycli
26+
USER 65532:65532
1227
ENTRYPOINT ["polycli"]
13-
CMD ["--help"]
28+
CMD ["--help"]
29+
30+
# How to test this image?
31+
# https://github.com/maticnetwork/polygon-cli/pull/189#discussion_r1464486344

0 commit comments

Comments
 (0)