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” ]