Simple hello world machine run example?

Ok got this working, I used the curl API before so I must have done something weird, but here is a simple reduced working example for anyone else who needs it:

Dockerfile:

FROM node:18-alpine

# Create app directory
WORKDIR /usr/src/app

COPY src ./src

CMD [ "node", "src/index.js" ]

src/index.js:

console.log('hello world')

Then create/run the machine:

fly machine run .

Follow the prompts, create an app, check your logs:

hello world

Thanks again @jerome

3 Likes