Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,9 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Docker compatibility with Podman
run: sudo ln -sf /usr/bin/podman /usr/local/bin/docker

- name: Build BitGoJS Express Docker Image
run: podman build .
run: ./scripts/build-docker-express.sh
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,13 @@ RUN cd /var/bitgo-express && \
yarn link @bitgo/sdk-coin-zec
#LINK_END

#LABEL_START
LABEL created="Thu, 04 Sep 2025 18:59:30 GMT"
LABEL version=15.0.0
LABEL git_hash=bbdf6e60b720b25e3212f3a4c5bdc81732a505e8
#LABEL_END
ARG BUILD_DATE
ARG VERSION
ARG GIT_HASH

LABEL created=${BUILD_DATE}
LABEL version=${VERSION}
LABEL git_hash=${GIT_HASH}

USER node
ENV NODE_ENV=production
Expand Down
3 changes: 1 addition & 2 deletions modules/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
"upload-artifacts": "node scripts/upload-test-reports.js",
"start": "node bin/bitgo-express",
"update-bitgo": "bash ./scripts/update-bitgo.sh",
"build-docker": "podman build -f ../../Dockerfile --platform=linux/amd64 -t bitgo/express:latest -t bitgo/express:$(jq -r .version < package.json) ../..",
"push-docker": "podman push bitgo/express:latest bitgo/express:$(jq -r .version < package.json)",
"build-docker": "cd ../../ && yarn update-dockerfile && ./scripts/build-docker-express.sh",
"check-fmt": "yarn prettier --check '{src,test}/**/*.{ts,js,json}'",
"unprettied": "grep -R -L --include '*.ts' --include '*.js' --include '*.json' '@prettier' src test",
"fmt": "yarn prettier --write '{src,test}/**/*.{ts,js,json}'"
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@
"dev": "tsc -b ./tsconfig.packages.json -w",
"prepare": "husky install",
"sdk-coin:new": "yo ./scripts/sdk-coin-generator",
"build-docker-express": "yarn update-dockerfile && podman build --platform=linux/amd64 -t bitgo/express:latest -t bitgo/express:$(jq -r .version < modules/express/package.json) .",
"push-docker-express": "podman push bitgo/express:latest && podman push bitgo/express:$(jq -r .version < modules/express/package.json)",
"build-docker-express": "yarn update-dockerfile && ./scripts/build-docker-express.sh",
"update-dockerfile": "tsx scripts/update-dockerfile.ts",
"precommit": "lint-staged",
"lint-fix": "lerna run lint --parallel -- --fix",
Expand Down
25 changes: 25 additions & 0 deletions scripts/build-docker-express.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

set -e

# Get dynamic build arguments
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
VERSION=$(jq -r .version < modules/express/package.json)
GIT_HASH=$(git rev-parse HEAD)

echo "Building Docker image with:"
echo " BUILD_DATE: $BUILD_DATE"
echo " VERSION: $VERSION"
echo " GIT_HASH: $GIT_HASH"

# Build the Docker image
docker build \
--platform=linux/amd64 \
--build-arg BUILD_DATE="$BUILD_DATE" \
--build-arg VERSION="$VERSION" \
--build-arg GIT_HASH="$GIT_HASH" \
-t bitgo/express:latest \
-t bitgo/express:"$VERSION" \
.

echo "Docker build completed successfully!"
8 changes: 1 addition & 7 deletions scripts/update-dockerfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,9 @@ async function updateDockerFile(lerna) {
.join(' && \\\n');
const linkContent = `RUN cd /var/bitgo-express && \\\n${linkers}\n`;

// add metadata about the build to docker labels
let labelContent = `LABEL created="${new Date().toUTCString()}"\n`; // add created timestamp;
labelContent += `LABEL version=${require('../modules/express/package.json').version}\n`; // set current image version from express
labelContent += `LABEL git_hash=${require('child_process').execSync(`git rev-parse HEAD`).toString().trim()}\n`; // set to latest git HEAD hash

dockerContents = dockerContents
.replace(/#COPY_START((.|\n)*)#COPY_END/, `#COPY_START\n${copyContent}#COPY_END`)
.replace(/#LINK_START((.|\n)*)#LINK_END/, `#LINK_START\n${linkContent}#LINK_END`)
.replace(/#LABEL_START((.|\n)*)#LABEL_END/, `#LABEL_START\n${labelContent}#LABEL_END`);
.replace(/#LINK_START((.|\n)*)#LINK_END/, `#LINK_START\n${linkContent}#LINK_END`);

fs.writeFileSync('Dockerfile', dockerContents);
}
Expand Down