Backend

FROM oven/bun:1

WORKDIR /usr/src/app

COPY . .

RUN bun install

RUN bun run generate:db

EXPOSE 8080

CMD ["bun", "start:backend"]

Websocket

FROM oven/bun:1

WORKDIR /usr/src/app

## Can you optimise this?
COPY . .

RUN bun install

RUN bun run generate:db

EXPOSE 8081

CMD ["bun", "start:ws"]
"start:ws": "cd apps/websocket && bun run index.ts",

Frontend

FROM oven/bun:1

ARG DB_URL

WORKDIR /usr/src/app

COPY . .

RUN bun install

RUN bun run generate:db
RUN DB_URL=$DB_URL bunx turbo build --filter=web...

EXPOSE 3000

# Start the frontend application
CMD ["bun", "start:frontend"]

<aside> 💡

Also add .dockerignore to make sure node_modules arent copied everywhere

</aside>