Docker issues while deploying app

I can build and deploy my app just running two commands locally, but on railway it just won’t see the built index.js file, hold on I’ll get more details now
3 Replies
Percy
Percy13mo ago
Project ID: 72410772-42cf-43c4-b589-92bfb7b38c8b
ImRopoxPro
ImRopoxProOP13mo ago
72410772-42cf-43c4-b589-92bfb7b38c8b
node:internal/modules/cjs/loader:1080
throw err;
^
Error: Cannot find module '/app/dist/index.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
at Module._load (node:internal/modules/cjs/loader:922:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
node:internal/modules/cjs/loader:1080
throw err;
^
Error: Cannot find module '/app/dist/index.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
at Module._load (node:internal/modules/cjs/loader:922:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
# First stage - build
FROM node:18 AS build

WORKDIR /app

COPY package.json .
COPY yarn.lock .

# Copy the rest of the application code
COPY . .

RUN yarn install --immutable
RUN yarn build:tsup

# Second stage - production
FROM node:18 as production

WORKDIR /app

ENV NODE_ENV=production

# Copy the built artifacts and other necessary files from the build stage
COPY --from=build /app/dist .
COPY --from=build /app/locales .

COPY --from=build /app/package.json .
COPY --from=build /app/yarn.lock .
COPY --from=build /app/node_modules .

CMD ["yarn", "start:prod"]
# First stage - build
FROM node:18 AS build

WORKDIR /app

COPY package.json .
COPY yarn.lock .

# Copy the rest of the application code
COPY . .

RUN yarn install --immutable
RUN yarn build:tsup

# Second stage - production
FROM node:18 as production

WORKDIR /app

ENV NODE_ENV=production

# Copy the built artifacts and other necessary files from the build stage
COPY --from=build /app/dist .
COPY --from=build /app/locales .

COPY --from=build /app/package.json .
COPY --from=build /app/yarn.lock .
COPY --from=build /app/node_modules .

CMD ["yarn", "start:prod"]
{
"name": "test",
"version": "0.0.12",
"description": "deez nutts",
"packageManager": "[email protected]",
"keywords": [],
"type": "module",
"scripts": {
"start:dev": "tsx watch src/index.ts",
"start:prod": "node dist/index.js --NODE_ENV=production",
"build:tsup": "tsup --silent false",
"build:docker": "docker build . -t bot",
"lint": "eslint . --fix",
"test": "jest",
"test:cov": "jest --coverage"
},
"license": "GPL-3.0",
"engines": {
"node": ">=14.16"
},
"dependencies": {
"@aws-sdk/client-rekognition": "^3.332.0",
//...
}
{
"name": "test",
"version": "0.0.12",
"description": "deez nutts",
"packageManager": "[email protected]",
"keywords": [],
"type": "module",
"scripts": {
"start:dev": "tsx watch src/index.ts",
"start:prod": "node dist/index.js --NODE_ENV=production",
"build:tsup": "tsup --silent false",
"build:docker": "docker build . -t bot",
"lint": "eslint . --fix",
"test": "jest",
"test:cov": "jest --coverage"
},
"license": "GPL-3.0",
"engines": {
"node": ">=14.16"
},
"dependencies": {
"@aws-sdk/client-rekognition": "^3.332.0",
//...
}
I can confirm tsup successfully built index.ts, both by looking to logs and testing locally
Brody
Brody13mo ago
does this dockerfile work locally?
Want results from more Discord servers?
Add your server