From 4a9a362da7a4eaa81fee4740d8c80fb87f0183cb Mon Sep 17 00:00:00 2001 From: Surendra Pathak Date: Tue, 4 Jul 2023 23:14:47 -0700 Subject: [PATCH 1/2] [ISSUE-19] Dockerize sbomasm --- Dockerfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..53f76f7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM golang:1.20-alpine AS builder +LABEL org.opencontainers.image.source="https://github.com/interlynk-io/sbomasm" + +RUN apk add --no-cache make +WORKDIR /app +COPY go.mod go.sum ./ +RUN go mod download +COPY . . +RUN make ; make build + +FROM scratch +LABEL org.opencontainers.image.source="https://github.com/interlynk-io/sbomasm" +LABEL org.opencontainers.image.description="SBOM Assembler - Assembler for SBOMs" +LABEL org.opencontainers.image.licenses=Apache-2.0 + +COPY --from=builder /app/build/sbomasm /app/sbomasm +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ + +ENTRYPOINT [ "/app/sbomasm"] \ No newline at end of file From 52cd4891887fbb76348d7862e9c2cba6a6ccdf4e Mon Sep 17 00:00:00 2001 From: Surendra Pathak Date: Tue, 4 Jul 2023 23:37:03 -0700 Subject: [PATCH 2/2] [NO-TKT] Automate container image publishing --- .github/workflows/build.yml | 36 ++++++++++++++++++++++++++++++++++++ .gitignore | 5 +---- 2 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..225df72 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: GHCR Publishing +on: + release: + types: + - created + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Get Tag + id: get_tag + run: echo "tag=$(git describe --tags HEAD)" > $GITHUB_ENV + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: GHCR login + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: '${{ github.actor }}' + password: '${{ secrets.GITHUB_TOKEN }}' + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/${{ github.repository }}:${{ env.tag }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index ce8ff52..ef0953e 100644 --- a/.gitignore +++ b/.gitignore @@ -15,9 +15,6 @@ vendor/ build/ -version.txt -*.yaml -*.yml -*.sbom +version.txt dist/