Skip to content

Commit

Permalink
Merge pull request #20 from interlynk-io/fix/dockerize
Browse files Browse the repository at this point in the history
[ISSUE-19] Dockerize sbomasm
  • Loading branch information
surendrapathak authored Jul 5, 2023
2 parents a0fcce2 + 52cd489 commit c932847
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 4 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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 }}
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
vendor/
build/

version.txt
*.yaml
*.yml
*.sbom
version.txt

dist/
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit c932847

Please sign in to comment.