Issue deploying simple Node app

Got a Node app that I wanna get online but I’m having this weird issue when I try to deploy. For whatever reason Volta can’t be found after installation. Flyctl is up to date. Still happens even if I delete Dockerfile and fly.toml and generate them again. Any help is appreciated.

$ flyctl deploy
==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-long-haze-9120 ready
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
Sending build context to Docker daemon  5.786kB
[+] Building 1.0s (7/14)
 => [internal] load remote build context                                                                                                                                     0.0s 
 => copy /context /                                                                                                                                                          0.0s 
 => [internal] load metadata for docker.io/library/debian:bullseye                                                                                                           0.7s 
 => CACHED [stage-1 1/4] FROM docker.io/library/debian:bullseye@sha256:43ef0c6c3585d5b406caa7a0f232ff5a19c1402aeb415f68bcd1cf9d10180af8                                      0.0s 
 => CACHED [builder 2/8] RUN apt-get update; apt install -y curl                                                                                                             0.0s 
 => CACHED [builder 3/8] RUN curl https://get.volta.sh | bash                                                                                                                0.0s 
 => ERROR [builder 4/8] RUN volta install node@18.14.1                                                                                                                       0.3s 
------
 > [builder 4/8] RUN volta install node@18.14.1:
#7 0.287 /bin/sh: 1: volta: not found
------
Error failed to fetch an image or build from source: error building: executor failed running [/bin/sh -c volta install node@${NODE_VERSION}]: exit code: 127

Dockerfile:

FROM debian:bullseye as builder

ARG NODE_VERSION=18.14.1

RUN apt-get update; apt install -y curl
RUN curl https://get.volta.sh | bash
ENV VOLTA_HOME /root/.volta
ENV PATH /root/.volta/bin:$PATH
RUN volta install node@${NODE_VERSION}

#######################################################################

RUN mkdir /app
WORKDIR /app

ENV NODE_ENV production

COPY . .

RUN npm install
FROM debian:bullseye

LABEL fly_launch_runtime="nodejs"

COPY --from=builder /root/.volta /root/.volta
COPY --from=builder /app /app

WORKDIR /app
ENV NODE_ENV production
ENV PATH /root/.volta/bin:$PATH

CMD [ "npm", "run", "start" ]

Can you run your docker image locally and see if it works?

Locally works just fine, it’s when I run fly deploy I run into this issue

What I’m super confused about is that this was working fine yesterday, didn’t change anything in my Dockerfile and suddenly I’m no longer able to deploy. My Node app itself has no issues running either. I have a strong feeling there’s something going on with the VM.

Looks like the problem is in the builder cache. It seems to have cached the results of get.volta.sh but volta can’t be found. Try:

fly apps destroy -y fly-builder-long-haze-9120
fly deploy
2 Likes

Yeah worked perfect. Thanks :smiley: