Hi, my node.js app deployment is failing on Windows 10 with the error below. I’m running fly launch from the root folder of my application. There is a yarn.lock file in this directory.
I’ve tried running fly deploy --local-only and get the same error.
…
=> ERROR [build 2/6] COPY --link package.json yarn.lock ./ 0.0s
[build 2/6] COPY --link package.json yarn.lock ./:
Error: failed to fetch an image or build from source: error building: failed to solve: failed to compute cache key: failed to calculate checksum of ref d68c46ff-e8b3-4b62-9d50-445a5902d34d::efgfc8l6g4erhs9uxnyv0vgkw: “/yarn.lock”: not found
Dockerfile:
syntax = docker/dockerfile:1
Adjust NODE_VERSION as desired
ARG NODE_VERSION=16.20.2
FROM node:${NODE_VERSION}-slim as base
LABEL fly_launch_runtime=“Node.js”
Node.js app lives here
WORKDIR /app
Set production environment
ENV NODE_ENV=“production”
ARG YARN_VERSION=1.22.22
RUN npm install -g yarn@$YARN_VERSION --force
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 pkg-config python
Install node modules
COPY --link package.json yarn.lock ./
RUN yarn install --frozen-lockfile --production=false
Copy application code
COPY --link . .
Build application
RUN yarn run build
Remove development dependencies
RUN yarn install --production=true
Final stage for app image
FROM base
Copy built application
COPY --from=build /app /app
Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD [ “yarn”, “run”, “start” ]