Fatal build crash: New Node.js app via Dockerlile exiting with error code 0

Dear community,
I deployed a Node.js app via a Dockerfile and it doesnt start up.
The server folder is part of a turborepo monorepo.
Cant interpret these errors. I looked up all of them but didnt give much insight.

Anyone has an idea? Thanx in advance!

Below you find the monitor log, the fly.toml and the Dockerfile.


Waiting for logs...

2023-12-02T12:51:48.432 proxy[3d8dd12a144618] ams [info] Starting machine

2023-12-02T12:51:48.791 app[3d8dd12a144618] ams [info] [ 0.048693] PCI: Fatal: No config space access function found

2023-12-02T12:51:49.014 app[3d8dd12a144618] ams [info] INFO Starting init (commit: 15238e9)...

2023-12-02T12:51:49.031 app[3d8dd12a144618] ams [info] INFO Preparing to run: `docker-entrypoint.sh node` as root

2023-12-02T12:51:49.044 app[3d8dd12a144618] ams [info] INFO [fly api proxy] listening at /.fly/api

2023-12-02T12:51:49.048 app[3d8dd12a144618] ams [info] 2023/12/02 12:51:49 listening on [fdaa:3:b9de:a7b:23c2:7931:9b99:2]:22 (DNS: [fdaa::3]:53)

2023-12-02T12:51:49.104 proxy[3d8dd12a144618] ams [info] machine started in 671.854531ms

2023-12-02T12:51:50.045 app[3d8dd12a144618] ams [info] INFO Main child exited normally with code: 0

2023-12-02T12:51:50.046 app[3d8dd12a144618] ams [info] INFO Starting clean up.

2023-12-02T12:51:50.047 app[3d8dd12a144618] ams [info] WARN hallpass exited, pid: 307, status: signal: 15 (SIGTERM)

2023-12-02T12:51:50.054 app[3d8dd12a144618] ams [info] 2023/12/02 12:51:50 listening on [fdaa:3:b9de:a7b:23c2:7931:9b99:2]:22 (DNS: [fdaa::3]:53)

2023-12-02T12:51:51.047 app[3d8dd12a144618] ams [info] [ 2.304452] reboot: Restarting system

2023-12-02T12:51:51.192 runner[3d8dd12a144618] ams [info] machine exited with exit code 0, not restarting

2023-12-02T12:51:54.674 proxy[3d8dd12a144618] ams [info] waiting for machine to be reachable on 0.0.0.0:8080 (waited 5.569506694s so far)```

Fly.toml :

```app = "aivocabulary"
primary_region = "ams"

[build]

[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0
  processes = ["app"]

[[vm]]
  cpu_kind = "shared"
  cpus = 1
  memory_mb = 1024```

Dockerfile :

```FROM node:18 as builder

WORKDIR /app

COPY package.json ./
COPY yarn.lock ./

COPY apps/server/package.json ./apps/server/package.json

RUN yarn

COPY . .

RUN yarn build --filter=server
RUN rm -rf node_modules
RUN yarn --frozen-lockfile --prod


FROM node:18-alpine

WORKDIR /app

COPY --from=builder /app/apps/server/dist ./
COPY --from=builder /app/node_modules ./node_modules

EXPOSE 8080

Your dockerfile does not appear to contain a command? It normally would look something like:

CMD [ "yarn", "start" ]

Separately, it looks like your builder step is based on Node’s default (debian), but you final step is based on alpine. This is not a good idea. Either specify alpine on both or neither.

1 Like

:pray: thanx! Probably the command missing was the problem, but I changed the node image, too.

Doesn’t work yet but at least now I understand the error messages again, haha

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.