I’ve built a monorepo using Turborepo that contains an app and a couple of packages. My first attempt to deploy the app directly to DigitalOcean failed, and I think it’s because DO doesn’t offer certain features for configuring the build process, so I thought that creating a Docker image and deploying it via DigitalOcean’s container registry would be easier. So far it’s not.
For context, I’m completely new to Docker, and have only been using the basics of Turborepo for the past 8 months or so, and only for local tests. This is the first time I’ve tried to deploy any of the apps.
I’m trying to follow the example from this page:
My Dockerfile in the app folder—modified from the one on the page above—looks like this:
FROM node:20-alpine AS base
FROM base AS builder
# Set working directory
WORKDIR /app
RUN npm install turbo@^2.4.2
COPY . .
# Generate a partial monorepo with a pruned lockfile for a target workspace.
RUN turbo prune staff-portal --docker
# Add lockfile and package.json's of isolated subworkspace
FROM base AS installer
WORKDIR /app
# First install the dependencies (as they change less often)
COPY --from=builder /app/out/json/ .
RUN npm install --package-lock-only
# Build the project
COPY --from=builder /app/out/full/ .
RUN turbo run build
FROM base AS runner
# WORKDIR /app
CMD ["react-router-serve", "/app/build/server/index.js"]
When I build the image, only the first step shows in the output:
[+] Building 0.6s (6/6) FINISHED
=> [internal] load build definition from Dockerfile
=> => transferring dockerfile: 690B
=> [internal] load metadata for docker.io/library/node:20-alpine
=> [auth] library/node:pull token for registry-1.docker.io
=> [internal] load .dockerignore
=> => transferring context: 2B
=> CACHED [base 1/1] FROM docker.io/library/node:20-alpine@sha256:674181320f4f94582c6182eaa151bf92c6744d478be0f1d12db804b7d59b2d11
=> exporting to image
=> => exporting layers
=> => writing image sha256:3de5ea71651ce95b7525672a7da2d7cc93189299a5abf8627387d247b36c5109
=> => naming to docker.io/library/loa-portal:test
I’m completely lost on how to fix this.