Replies: 1 comment 2 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.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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