Skip to content

Commit

Permalink
Merge pull request #146 from hyperledger/base_image
Browse files Browse the repository at this point in the history
Add base and image args and fix python version
  • Loading branch information
EnriqueL8 authored May 23, 2024
2 parents 0940924 + c3ebe60 commit 2eb9c08
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/docker_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/docker_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
.
Expand Down
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
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 ./
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
Expand All @@ -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/
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 2eb9c08

Please sign in to comment.