Dockerfile.backend
FROM oven/bun:1
WORKDIR /usr/src/app
COPY . .
RUN bun install
RUN bun run generate:db
EXPOSE 8080
CMD ["bun", "start:backend"]
Add generate:db
and start:backend
script to root package.json
"generate:db": "cd packages/db && bunx prisma generate",
"start:backend": "cd apps/backend && bun run index.ts",
Dockerfile.ws
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
command"start:ws": "cd apps/websocket && bun run index.ts",
Dockerfile.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>