fly deploy ERROR [build 2/7] COPY --link package-lock.json package.json ./

Trying to deploy nestjs API(Node) and getting error on deploy
Error: failed to fetch an image or build from source: error building: failed to compute cache key: “/package-lock.json” not found: not found.

Below os my docker file

syntax = docker/dockerfile:1

Adjust NODE_VERSION as desired

ARG NODE_VERSION=18.13.0

FROM node:${NODE_VERSION}-slim as base

LABEL fly_launch_runtime=“NestJS/Prisma”

NestJS/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 -y python-is-python3 pkg-config build-essential openssl

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

Final stage for app image

FROM base

Copy built application

COPY --from=build /app /app

Entrypoint prepares the database.

ENTRYPOINT [ “/app/docker-entrypoint.js” ]

Start the server by default, this can be overwritten at runtime

EXPOSE 3000

CMD [ “npm”, “run”, “start” ]

Do you develop your app on your laptop/desktop without Docker?

package-lock.json is generated when you run npm install and this Dockerfile assumes that npm install was run at least once on your laptop/desktop.

Thanks, I realised it was listed in the dockerignore file, i was able to have it deployed but now the app has refused to spart, its always suspending after successful build and deploy.

That’s odd. Can you check fly logs?