Running my Dockerfile works locally but not during fly deploy
. I get:
$ fly deploy
==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-damp-sun-3191 ready
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
[+] Building 6.6s (0/1)
[+] Building 70.6s (10/10) FINISHED
=> [internal] load remote build context 0.0s
=> copy /context / 0.8s
=> [internal] load metadata for docker.io/library/node:18-bullseye 0.2s
=> [builder 1/5] FROM docker.io/library/node:18-bullseye@sha256:d871edd5b68105ebcbfcde3fe8c79d24cbdbb30430d9bd6251c57c56c7bd7646 0.0s
=> CACHED [builder 2/5] WORKDIR /app 0.0s
=> [builder 3/5] COPY . . 0.2s
=> [builder 4/5] RUN npm install -g npm@latest 4.7s
=> [builder 5/5] RUN npm install && npm run build 50.2s
=> [stage-1 3/4] COPY --from=builder /app /app 4.7s
=> ERROR [stage-1 4/4] RUN npm install 3.7s
------
> [stage-1 4/4] RUN npm install:
#10 3.613 npm notice
#10 3.613 npm notice New major version of npm available! 8.19.3 -> 9.3.1
#10 3.614 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.3.1>
#10 3.614 npm notice Run `npm install -g npm@9.3.1` to update!
#10 3.614 npm notice
#10 3.616 npm ERR! code 243
#10 3.616 npm ERR! path /app/apps/menu
#10 3.617 npm ERR! command failed
#10 3.617 npm ERR! command sh -c -- npm run tailwind
#10 3.617 npm ERR! > menu@0.0.1 tailwind
#10 3.618 npm ERR! > tailwindcss -i styles/globals.css -o styles/dist.css
#10 3.618 npm ERR! npm WARN logfile Error: EACCES: permission denied, scandir '/root/.npm/_logs'
#10 3.618 npm ERR! npm WARN logfile error cleaning log files [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
#10 3.618 npm ERR! npm WARN logfile errno: -13,
#10 3.618 npm ERR! npm WARN logfile code: 'EACCES',
#10 3.618 npm ERR! npm WARN logfile syscall: 'scandir',
#10 3.618 npm ERR! npm WARN logfile path: '/root/.npm/_logs'
#10 3.618 npm ERR! npm WARN logfile }
#10 3.618 npm ERR! npm ERR! code EACCES
#10 3.625 npm ERR! npm ERR! syscall mkdir
#10 3.625 npm ERR! npm ERR! path /root/.npm/_cacache/tmp
#10 3.625 npm ERR! npm ERR! errno -13
#10 3.625 npm ERR! npm ERR!
#10 3.625 npm ERR! npm ERR! Your cache folder contains root-owned files, due to a bug in
#10 3.625 npm ERR! npm ERR! previous versions of npm which has since been addressed.
#10 3.625 npm ERR! npm ERR!
#10 3.625 npm ERR! npm ERR! To permanently fix this problem, please run:
#10 3.625 npm ERR! npm ERR! sudo chown -R 501:20 "/root/.npm"
#10 3.625 npm ERR!
#10 3.625 npm ERR! npm ERR! Log files were not written due to an error writing to the directory: /root/.npm/_logs
#10 3.625 npm ERR! npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
#10 3.625 npm ERR!
#10 3.625 npm ERR! Rebuilding...
#10 3.625 npm ERR!
#10 3.625 npm ERR! Done in 524ms.
#10 3.627
#10 3.627 npm ERR! A complete log of this run can be found in:
#10 3.627 npm ERR! /root/.npm/_logs/2023-01-18T04_12_18_117Z-debug-0.log
------
Error failed to fetch an image or build from source: error building: executor failed running [/bin/sh -c npm install]: exit code: 243
with Dockerfile:
FROM node:18-bullseye AS builder
WORKDIR /app
COPY . .
RUN npm install -g npm@latest
RUN npm install && npm run build
FROM node:18-bullseye
WORKDIR /app
COPY --from=builder /app /app
ENV NODE_ENV production
RUN npm install
CMD ["node", "apps/worker/lib/worker.js"]