Thanks Rubys, I tried following it but i still get the below error:
2024-01-03T16:20:46.104 proxy[3287577db75498] arn [info] machine started in 543.742816ms
2024-01-03T16:20:47.062 app[3287577db75498] arn [info] > atlantic-seafood-api-prototype@1.0.0 start
2024-01-03T16:20:47.062 app[3287577db75498] arn [info] > node build/app.js
2024-01-03T16:20:47.112 app[3287577db75498] arn [info] node:internal/modules/cjs/loader:1147
2024-01-03T16:20:47.112 app[3287577db75498] arn [info] throw err;
2024-01-03T16:20:47.112 app[3287577db75498] arn [info] ^
2024-01-03T16:20:47.112 app[3287577db75498] arn [info] Error: Cannot find module ‘/app/build/app.js’
2024-01-03T16:20:47.112 app[3287577db75498] arn [info] at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
2024-01-03T16:20:47.112 app[3287577db75498] arn [info] at Module._load (node:internal/modules/cjs/loader:985:27)
2024-01-03T16:20:47.112 app[3287577db75498] arn [info] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
2024-01-03T16:20:47.112 app[3287577db75498] arn [info] at node:internal/main/run_main_module:28:49 {
2024-01-03T16:20:47.112 app[3287577db75498] arn [info] code: ‘MODULE_NOT_FOUND’,
2024-01-03T16:20:47.112 app[3287577db75498] arn [info] requireStack:
2024-01-03T16:20:47.112 app[3287577db75498] arn [info] }
Even though the deployment seems to run fine.
This is my docker file:
syntax = docker/dockerfile:1
Adjust NODE_VERSION as desired
ARG NODE_VERSION=20.10.0
FROM node:${NODE_VERSION}-slim as base
LABEL fly_launch_runtime=“Node.js/Prisma”
Node.js/Prisma app lives here
WORKDIR /app
Set production environment
ENV NODE_ENV=“production”
Throw-away build stage to reduce size of final image
FROM base as build
Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential node-gyp openssl pkg-config python-is-python3
Install node modules
COPY --link package-lock.json package.json ./
RUN npm ci --include=dev
Generate Prisma Client
COPY --link prisma .
RUN npx prisma generate
Copy application code
COPY --link . .
Build application
RUN npm run build
Remove development dependencies
RUN npm prune --omit=dev
Final stage for app image
FROM base
Install packages needed for deployment
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y openssl && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives
Copy built application
COPY --from=build /app /app
Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD [ “npm”, “run”, “start” ]