Replies: 3 comments 3 replies
-
For anyone else looking to solve this still, compare your approach to: Project structure: $ tree -L 3 -I 'node_modules'
.
├── README.md
├── bun.lockb
├── package.json
├── packages
│ ├── pkg-a
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── src
│ │ └── tsconfig.json
│ └── pkg-b
│ ├── README.md
│ ├── package.json
│ ├── src
│ └── tsconfig.json
└── tsconfig.json Dockerfile: # Use the official Bun image
FROM oven/bun:1
# Set working directory
WORKDIR /app
# Copy package.json files
COPY package.json bun.lockb ./
COPY packages/pkg-a/package.json ./packages/pkg-a/
COPY packages/pkg-b/package.json ./packages/pkg-b/
# Install dependencies
RUN bun install --frozen-lockfile
# Copy the rest of the application
COPY . .
# Set the entrypoint to run pkg-a
CMD ["bun", "run", "packages/pkg-a/src/index.ts"] Build image: docker build -f packages/pkg-a/Dockerfile -t docker-bun-workspace . Workspace config mirrors that found @ https://bun.sh/guides/install/workspaces |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I was looking into this quite a while ago now but to your first point, yes, installing deps for all packages was the workaround (at the time; not sure if applicable still). Not 100% on your second point but I see your point and... probably, yes? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm looking to go monorepo and use https://bun.sh/docs/install/workspaces but I'm unsure how to build docker images when the app has one or more workspace dependencies. Currently our dockerfiles are structured as per https://bun.sh/guides/ecosystem/docker
Is anyone doing docker builds from workspaces? Care to share a dockerfile?
Beta Was this translation helpful? Give feedback.
All reactions