Skip to content

Commit

Permalink
Merge pull request hyperledger#125 from hyperledger/base_image
Browse files Browse the repository at this point in the history
Allow configuration of a base and build image in Dockerfile
  • Loading branch information
peterbroadhurst authored and EnriqueL8 committed May 28, 2024
1 parent acf3f3b commit c0fa232
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/docker_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ jobs:
--label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--label tag=${{ steps.build_tag_generator.outputs.BUILD_TAG }} \
<<<<<<< HEAD
<<<<<<< HEAD
=======
--build-arg BASE_IMAGE=alpine:3.19 \
--build-arg BUILD_IMAGE=golang:1.21-alpine3.19 \
>>>>>>> 66e0aba (Add build image arg)
=======
--build-arg BASE_IMAGE=alpine:3.19 \
--build-arg BUILD_IMAGE=golang:1.21-alpine3.19 \
>>>>>>> 3a3c7af (Merge pull request #125 from hyperledger/base_image)
--tag ghcr.io/hyperledger/firefly-fabconnect:${{ steps.build_tag_generator.outputs.BUILD_TAG }} .

- name: Tag release
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/docker_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ jobs:
--label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--label tag=${GITHUB_REF##*/} \
<<<<<<< HEAD
<<<<<<< HEAD
=======
--build-arg BASE_IMAGE=alpine:3.19 \
--build-arg BUILD_IMAGE=golang:1.21-alpine3.19 \
>>>>>>> 66e0aba (Add build image arg)
=======
--build-arg BASE_IMAGE=alpine:3.19 \
--build-arg BUILD_IMAGE=golang:1.21-alpine3.19 \
>>>>>>> 3a3c7af (Merge pull request #125 from hyperledger/base_image)
--tag ghcr.io/hyperledger/firefly-fabconnect:${GITHUB_REF##*/} \
--tag ghcr.io/hyperledger/firefly-fabconnect:head \
.
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ jobs:
--label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--label tag=${{ steps.build_tag_generator.outputs.BUILD_TAG }} \
<<<<<<< HEAD
<<<<<<< HEAD
=======
--build-arg BASE_IMAGE=alpine:3.19 \
--build-arg BUILD_IMAGE=golang:1.21-alpine3.19 \
>>>>>>> 66e0aba (Add build image arg)
=======
--build-arg BASE_IMAGE=alpine:3.19 \
--build-arg BUILD_IMAGE=golang:1.21-alpine3.19 \
>>>>>>> 3a3c7af (Merge pull request #125 from hyperledger/base_image)
--tag ghcr.io/hyperledger/firefly-fabconnect:${{ steps.build_tag_generator.outputs.BUILD_TAG }} .
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
<<<<<<< HEAD
<<<<<<< HEAD
FROM golang:1.21-alpine3.19 AS fabconnect-builder
=======
=======
>>>>>>> 3a3c7af (Merge pull request #125 from hyperledger/base_image)
ARG BASE_IMAGE
ARG BUILD_IMAGE

FROM ${BUILD_IMAGE} AS fabconnect-builder
<<<<<<< HEAD
>>>>>>> 66e0aba (Add build image arg)
=======
>>>>>>> 3a3c7af (Merge pull request #125 from hyperledger/base_image)
RUN apk add make
ADD . /fabconnect
WORKDIR /fabconnect
Expand All @@ -14,7 +20,19 @@ RUN mkdir /.cache \
&& chmod -R g+rwX /.cache
RUN make

<<<<<<< HEAD
FROM alpine:3.19
=======
FROM alpine:3.19 AS SBOM
WORKDIR /
COPY . /SBOM
RUN apk add --no-cache curl
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.48.3
RUN trivy fs --format spdx-json --output /sbom.spdx.json /SBOM
RUN trivy sbom /sbom.spdx.json --severity UNKNOWN,HIGH,CRITICAL --exit-code 1 --ignorefile /SBOM/.trivyignore

FROM $BASE_IMAGE
>>>>>>> 3a3c7af (Merge pull request #125 from hyperledger/base_image)
RUN apk add curl
WORKDIR /fabconnect
COPY --from=fabconnect-builder /fabconnect/fabconnect ./
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ firefly-fabconnect: ${GOFILES}
go-mod-tidy: .ALWAYS
go mod tidy
<<<<<<< HEAD
<<<<<<< HEAD
=======
docker:
docker build --build-arg BASE_IMAGE=alpine:3.19 --build-arg BUILD_IMAGE=golang:1.21-alpine3.19 -t hyperledger/firefly-fabconnect .
>>>>>>> 66e0aba (Add build image arg)
=======
docker:
docker build --build-arg BASE_IMAGE=alpine:3.19 --build-arg BUILD_IMAGE=golang:1.21-alpine3.19 -t hyperledger/firefly-fabconnect .
>>>>>>> 3a3c7af (Merge pull request #125 from hyperledger/base_image)
build: firefly-fabconnect-nocgo firefly-fabconnect
.ALWAYS: ;
clean:
Expand Down

0 comments on commit c0fa232

Please sign in to comment.