Skip to content

Commit 526e370

Browse files
committed
fix: keep all build assets in "lib" directory instead of "dist" for backward-compatibility with the old engine images
1 parent 35fc808 commit 526e370

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ RUN yarn install --frozen-lockfile --production
2222

2323
FROM base AS production
2424
COPY --from=prod-dependencies /root/cf-runtime/node_modules ./node_modules
25-
COPY --from=build /root/cf-runtime/dist ./dist
26-
COPY . .
25+
COPY --from=build /root/cf-runtime/dist ./lib
2726

2827
#purpose of security
2928
RUN npm -g uninstall npm
3029

3130
USER cfu
32-
CMD ["node", "dist/index.js"]
31+
CMD ["node", "lib/index.js"]

lib/forever.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
while ($true) {
22
Start-Sleep -s 1
3-
& node dist/index.js
3+
& node lib/index.js
44
}

lib/isReady.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function isContainerLoggerReady(state) {
2323

2424
(() => {
2525
const containerId = process.argv[2];
26-
const state = JSON.parse(readFileSync('./dist/state.json').toString('utf-8'));
26+
const state = JSON.parse(readFileSync('./lib/state.json').toString('utf-8'));
2727
let isReady = false;
2828
if (containerId) {
2929
isReady = isContainerReady(state, containerId);

lib/isReady.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $CONTAINER_ID=$args[0]
66

77
if ( $CONTAINER_ID ) {
88
echo "checking if container:$CONTAINER_ID exists"
9-
if (select-string -Pattern $CONTAINER_ID -Path ./dist/state.json) {
9+
if (select-string -Pattern $CONTAINER_ID -Path ./lib/state.json) {
1010
echo "container $CONTAINER_ID is ready"
1111
Exit 0
1212
} else {
@@ -15,7 +15,7 @@ if ( $CONTAINER_ID ) {
1515
}
1616
} else {
1717
echo "checking if container logger is ready"
18-
if (select-string -Pattern "ready" -Path ./dist/state.json) {
18+
if (select-string -Pattern "ready" -Path ./lib/state.json) {
1919
echo "ready"
2020
Exit 0
2121
} else {

lib/isReady.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ CONTAINER_ID=$1
77

88
if [ -n "$CONTAINER_ID" ]; then
99
echo "checking if container: $CONTAINER_ID exists"
10-
grep -q $CONTAINER_ID ./dist/state.json
10+
grep -q $CONTAINER_ID ./lib/state.json
1111
else
1212
echo "checking if container logger is ready"
13-
grep -q "ready" ./dist/state.json
13+
grep -q "ready" ./lib/state.json
1414
fi
1515

1616

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"test:ci": "yarn test",
5454
"start": "node dist/index.js",
5555
"version": "exit 0",
56-
"build": "rm -rf dist && tsc -p tsconfig.json"
56+
"build": "rm -rf dist && tsc -p tsconfig.json && yarn run build:copy-scripts",
57+
"build:copy-scripts": "cp ./lib/*.sh ./lib/*.ps1 ./dist"
5758
}
5859
}

0 commit comments

Comments
 (0)