Multistage Dockerfile creates additonal apps

Hey team,

Upfront, I’m very new to docker, but I’m testing out deploying with a Dockerfile. Read a blog post about using multiple stages to optimize the image, so I tested it out. I noticed every the image was rebuilt, a second app was created on my fly.io dashboard. Is this expected?

I could opt to just using the default node builder, but I thought I would give this a shot. Any advice here?

Dockerfile below

FROM node:16-alpine AS BUILD_IMAGE

RUN apk update && apk add curl bash python3 make g++ && rm -rf /var/cache/apk/*

# install node-prune (https://github.com/tj/node-prune)
RUN curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash -s -- -b /usr/local/bin

WORKDIR /app

COPY package.json ./

# install dependencies
RUN npm install

COPY . .

# build application
RUN npm run build

# remove development dependencies
RUN npm prune --production

# run node prune
RUN /usr/local/bin/node-prune

FROM node:16-alpine

WORKDIR /app

# copy from build image
COPY --from=BUILD_IMAGE /app/package.json ./
COPY --from=BUILD_IMAGE /app/server ./server
COPY --from=BUILD_IMAGE /app/dist ./dist
COPY --from=BUILD_IMAGE /app/node_modules ./node_modules

env PORT=8080

EXPOSE 8080

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

flyctl creates a remote builder app which runs the Docker daemon unless you have it running locally. The name should end in “builder” and it shuts down after a few minutes of inactivity. Is that what you’re seeing?

That must be it. I’ll check it out, but that sounds right! Thanks much!

We don’t charge for builders! The plan is to include X amount of free build minutes and charge for anything over that in the future, but they’re all free for now.

1 Like

Are the builders built by… other builders? Is it builders all the way down?

I had to think about that. Sadly, no, they’re built by GitHub actions: GitHub - superfly/rchab: Remote Controlled Hot Air Balloon