diff --git a/.github/workflows/docker_main.yml b/.github/workflows/docker_main.yml index d67bd62..03caa60 100644 --- a/.github/workflows/docker_main.yml +++ b/.github/workflows/docker_main.yml @@ -24,6 +24,8 @@ jobs: --label commit=$GITHUB_SHA \ --label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ --label tag=${{ steps.build_tag_generator.outputs.BUILD_TAG }} \ + --build-arg BASE_IMAGE=node:20-alpine3.19 \ + --build-arg BUILD_IMAGE=node:20-alpine3.19 \ --tag ghcr.io/hyperledger/firefly-tokens-erc1155:${{ steps.build_tag_generator.outputs.BUILD_TAG }} . - name: Tag release diff --git a/.github/workflows/docker_release.yml b/.github/workflows/docker_release.yml index bf9619e..afaa716 100644 --- a/.github/workflows/docker_release.yml +++ b/.github/workflows/docker_release.yml @@ -18,6 +18,8 @@ jobs: --label commit=$GITHUB_SHA \ --label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ --label tag=${GITHUB_REF##*/} \ + --build-arg BASE_IMAGE=node:20-alpine3.19 \ + --build-arg BUILD_IMAGE=node:20-alpine3.19 \ --tag ghcr.io/hyperledger/firefly-tokens-erc1155:${GITHUB_REF##*/} \ --tag ghcr.io/hyperledger/firefly-tokens-erc1155:head \ . diff --git a/Dockerfile b/Dockerfile index ae2b19c..f0efcd3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ -FROM node:20-alpine3.19 as solidity-build -RUN apk add python3=3.11.8-r0 alpine-sdk=1.0-r1 +ARG BASE_IMAGE +ARG BUILD_IMAGE + +FROM ${BUILD_IMAGE} as solidity-build +RUN apk add python3=3.11.9-r0 alpine-sdk=1.0-r1 USER node WORKDIR /home/node ADD --chown=node:node ./samples/solidity/package*.json ./ @@ -7,7 +10,7 @@ RUN npm install ADD --chown=node:node ./samples/solidity . RUN npx hardhat compile -FROM node:20-alpine3.17 as build +FROM ${BUILD_IMAGE} as build WORKDIR /root ADD package*.json ./ RUN npm install @@ -22,7 +25,7 @@ RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/ RUN trivy fs --format spdx-json --output /sbom.spdx.json /SBOM RUN trivy sbom /sbom.spdx.json --severity UNKNOWN,HIGH,CRITICAL --exit-code 1 -FROM node:20-alpine3.19 +FROM $BASE_IMAGE RUN apk add curl=8.5.0-r0 # We also need to keep copying it to the old location to maintain compatibility with the FireFly CLI COPY --from=solidity-build --chown=1001:0 /home/node/artifacts/contracts/ERC1155MixedFungible.sol/ERC1155MixedFungible.json /root/contracts/ diff --git a/package.json b/package.json index e4a258f..b9916be 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "scripts": { "prebuild": "rimraf dist", "build": "nest build", + "docker": "docker build --build-arg BASE_IMAGE=node:20-alpine3.19 --build-arg BUILD_IMAGE=node:20-alpine3.19 --tag hyperledger/firefly-tokens-erc1155 .", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "start": "nest start", "start:dev": "nest start --watch",