You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Turborepo with a app I want to build with Docker and run on my VPS: apps/backend
I also have Turborepo packages; packages/voicy-common/**
I've found the Dockerfile in your example whcih seems to work fine:
# https://github.com/vercel/turborepo/blob/main/examples/with-docker/apps/api/DockerfileFROM node:20-alpine AS base
FROM base AS builder
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.RUN apk update
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Copy the entire monorepo (only once). # This is just so that npx turbo has access # to all dependencies it needs to prune properly.COPY . .
RUN npx turbo prune --scope=@voicy/backend --docker
# Add lockfile and package.json's of isolated subworkspaceFROM base AS installer
RUN apk update
RUN apk add --no-cache libc6-compat
WORKDIR /app
# First install dependencies (as they change less often)COPY --from=builder /app/out/json/ .
RUN npm install
# Build the project and its dependenciesCOPY --from=builder /app/out/full/ .
# Uncomment and use build args to enable remote caching# ARG TURBO_TEAM# ENV TURBO_TEAM=$TURBO_TEAM# ARG TURBO_TOKEN# ENV TURBO_TOKEN=$TURBO_TOKEN# Now build just the backend packageRUN npx turbo run build:server
FROM base AS runner
WORKDIR /app
COPY --from=installer /app .
CMD ["node", "apps/backend/dist/app.js"]
Although I run into the error: Error: Cannot find module '@voicy/common/utils/dates'
Because my files still contain:
My apps/backend is a Koa simple application, with the build:server script: "build:server": "tsc --build tsconfig.build.json"
Somehow it seems the packages can't be compiled or found. My /out folder after prune, seems fine?
I'm not sure what I'm missing or misunderstand. Anyone can push me in the correct direction on bundling a server application using files from the /packages/** folder? Bundling the apps/web (NextJS) works perfectly fine.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I have a Turborepo with a app I want to build with Docker and run on my VPS:
apps/backendI also have Turborepo packages;
packages/voicy-common/**I've found the Dockerfile in your example whcih seems to work fine:
Although I run into the error:

Error: Cannot find module '@voicy/common/utils/dates'Because my files still contain:
My apps/backend is a Koa simple application, with the build:server script:
"build:server": "tsc --build tsconfig.build.json"Somehow it seems the packages can't be compiled or found. My

/outfolder after prune, seems fine?I'm not sure what I'm missing or misunderstand. Anyone can push me in the correct direction on bundling a server application using files from the
/packages/**folder? Bundling the apps/web (NextJS) works perfectly fine.Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions