-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
What version of Turborepo are you using?
1.1.1
What package manager are you using / does the bug impact?
Yarn v1
What operating system are you using?
Mac
Describe the Bug
When running the turbo prune --scope=web
, the out/
folder has the following structure:
- apps
- full
- json
- packages
- .gitignore
- package.json
- yarn.lock
since running the npx @turbo/codemod create-turbo-config
codemod I have the turbo.json
.
This caused some issues when building the app using docker
Here's my Dockerfile
FROM node:16-alpine AS builder
ARG APP_SCOPE
ENV APP_SCOPE ${APP_SCOPE}
RUN apk update && apk add --no-cache git
# Set working directory
WORKDIR /app
RUN yarn global add turbo
COPY . .
RUN turbo prune --scope=${APP_SCOPE} --docker
# Add lockfile and package.json's of isolated subworkspace
FROM node:16-alpine AS installer
RUN apk update && apk add --no-cache git
WORKDIR /app
#set CI variable to true
ENV CI=true
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/yarn.lock ./yarn.lock
RUN yarn install --immutable
FROM node:16-alpine AS sourcer
ARG APP_SCOPE
ENV APP_SCOPE ${APP_SCOPE}
RUN apk update && apk add --no-cache git
WORKDIR /app
COPY --from=installer /app/ .
COPY --from=builder /app/out/full/ .
COPY .gitignore .gitignore
RUN NODE_ENV=production yarn turbo run build --scope=${APP_SCOPE} --include-dependencies --no-deps
EXPOSE 3000
CMD yarn turbo run start --scope=${APP_SCOPE}
I've fixed it with
FROM node:16-alpine AS builder
ARG APP_SCOPE
ENV APP_SCOPE ${APP_SCOPE}
RUN apk update && apk add --no-cache git
# Set working directory
WORKDIR /app
RUN yarn global add turbo
COPY . .
RUN turbo prune --scope=${APP_SCOPE} --docker
# Add lockfile and package.json's of isolated subworkspace
FROM node:16-alpine AS installer
RUN apk update && apk add --no-cache git
WORKDIR /app
#set CI variable to true
ENV CI=true
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/yarn.lock ./yarn.lock
# Add turbo.json's from the root
COPY --from=builder /app/turbo.json ./turbo.json
RUN yarn install --immutable
FROM node:16-alpine AS sourcer
ARG APP_SCOPE
ENV APP_SCOPE ${APP_SCOPE}
RUN apk update && apk add --no-cache git
WORKDIR /app
COPY --from=installer /app/ .
COPY --from=builder /app/out/full/ .
COPY .gitignore .gitignore
RUN NODE_ENV=production yarn turbo run build --scope=${APP_SCOPE} --include-dependencies --no-deps
EXPOSE 3000
CMD yarn turbo run start --scope=${APP_SCOPE}
Expected Behavior
turbo.json
file should be included in the out/
or out/json/
folder
then my Dockerfile would look like this
FROM node:16-alpine AS builder
ARG APP_SCOPE
ENV APP_SCOPE ${APP_SCOPE}
RUN apk update && apk add --no-cache git
# Set working directory
WORKDIR /app
RUN yarn global add turbo
COPY . .
RUN turbo prune --scope=${APP_SCOPE} --docker
# Add lockfile and package.json's of isolated subworkspace
FROM node:16-alpine AS installer
RUN apk update && apk add --no-cache git
WORKDIR /app
#set CI variable to true
ENV CI=true
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/turbo.json ./turbo.json
COPY --from=builder /app/out/yarn.lock ./yarn.lock
RUN yarn install --immutable
FROM node:16-alpine AS sourcer
ARG APP_SCOPE
ENV APP_SCOPE ${APP_SCOPE}
RUN apk update && apk add --no-cache git
WORKDIR /app
COPY --from=installer /app/ .
COPY --from=builder /app/out/full/ .
COPY .gitignore .gitignore
RUN NODE_ENV=production yarn turbo run build --scope=${APP_SCOPE} --include-dependencies --no-deps
EXPOSE 3000
CMD yarn turbo run start --scope=${APP_SCOPE}
Or just as it was already
FROM node:16-alpine AS builder
ARG APP_SCOPE
ENV APP_SCOPE ${APP_SCOPE}
RUN apk update && apk add --no-cache git
# Set working directory
WORKDIR /app
RUN yarn global add turbo
COPY . .
RUN turbo prune --scope=${APP_SCOPE} --docker
# Add lockfile, turbo.json and package.json's of isolated subworkspace
FROM node:16-alpine AS installer
RUN apk update && apk add --no-cache git
WORKDIR /app
#set CI variable to true
ENV CI=true
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/yarn.lock ./yarn.lock
RUN yarn install --immutable
FROM node:16-alpine AS sourcer
ARG APP_SCOPE
ENV APP_SCOPE ${APP_SCOPE}
RUN apk update && apk add --no-cache git
WORKDIR /app
COPY --from=installer /app/ .
COPY --from=builder /app/out/full/ .
COPY .gitignore .gitignore
RUN NODE_ENV=production yarn turbo run build --scope=${APP_SCOPE} --include-dependencies --no-deps
EXPOSE 3000
CMD yarn turbo run start --scope=${APP_SCOPE}
To Reproduce
- Init new turborepo project
- Run
turbo prune --scope=web
- There's no
turbo.json
file in theout/
or `out/json/ folder
Metadata
Metadata
Assignees
Labels
No labels