0

I have a node project with 2 entry points - index.js (api server) and process.js (worker). I want to run them both inside one fly app only.

I have setup package.json to run with index.js as starting point using “npm run serve” and with process.js using “npm run worker”

How can I create the fly.toml and dockerfile to achieve this?

I have tried creating the dockerfile it now.

FROM node:18-alpine

ARG SHOPIFY_API_KEY
ENV SHOPIFY_API_KEY=$SHOPIFY_API_KEY
EXPOSE 8081 8082
WORKDIR /app
COPY web .
RUN npm install
RUN cd frontend && npm install && npm run build
CMD ["sh", "-c", "if [ \"$APP_START_CMD\" = \"process\" ]; then npm run worker; else npm run serve; fi"]
Aditya
  • 84
  • 3
  • Can you use the `fly.toml` [`processes` section](https://fly.io/docs/reference/configuration/#the-processes-section) to launch multiple containers from the same image, overriding the command? – David Maze Apr 26 '23 at 13:35

0 Answers0