Mind if I ask why not? I see you mentioned node, and small app. I’m trying to encourage node users to try docker: New nodejs launcher
Could something like the following work for you?
FROM debian:bullseye as builder
ARG NODE_VERSION=18.10.0
ARG YARN_VERSION=1.22.19
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} yarn@${YARN_VERSION}
#######################################################################
RUN mkdir /app
WORKDIR /app
ENV NODE_ENV production
COPY . .
RUN yarn install && yarn run build
FROM debian:bullseye
COPY --from=builder /root/.volta /root/.volta
COPY --from=builder /app /app
WORKDIR /app
ENV PATH /root/.volta/bin:$PATH
CMD [ "yarn", "run", "start" ]
Change the NODE_VERSION and YARN_VERSION to match node -v
and yarn -v
. If you aren’t using yarn, remove the setting of YARN_VERSION, installing yarn via volta, and change yarn to npm everywhere. If you don’t have a build step remove && yarn run build
. Oh, and remove the [build]
instructions from fly.toml
.
If your app has special needs that aren’t met by this simple Dockerfile, I’d love to hear about it.