Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix for studio dockerFile to support turborepo

Francisco Mazzoni53ae226b0044
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000000..b5924c32836
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,7 @@
+node_modules/
+.vercel
+.next
+.env.local
+.env.production
+.env.dev
+.env.*
\ No newline at end of file
diff --git a/docker/.dockerignore b/docker/.dockerignore
new file mode 100644
index 00000000000..b5924c32836
--- /dev/null
+++ b/docker/.dockerignore
@@ -0,0 +1,7 @@
+node_modules/
+.vercel
+.next
+.env.local
+.env.production
+.env.dev
+.env.*
\ No newline at end of file
diff --git a/studio/Dockerfile b/studio/Dockerfile
index dd58253ec2a..77af0a213e6 100644
--- a/studio/Dockerfile
+++ b/studio/Dockerfile
@@ -6,25 +6,38 @@
# docker build --target production --no-cache -t supabase/studio:latest .
# docker builder prune
-
-FROM node:14-slim as base
+FROM node:16-slim as base
RUN apt-get update && apt-get install -y \
python3 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
+
+FROM base as builder
WORKDIR /usr/src/app
-# Do `npm ci` separately so we can cache `node_modules`
-# https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
-COPY package*.json ./
-RUN npm clean-install && npm cache clean --force
-COPY . .
+# the following command is still unsupported for npm // https://github.com/vercel/turborepo/issues/1830
+# RUN npm i -g turbo
+COPY package*.json .
+COPY turbo.json .
+COPY packages packages
+COPY studio studio
+# the following command is still unsupported for npm // https://github.com/vercel/turborepo/issues/1830
+# RUN turbo prune --scope=studio --docker
+# RUN npm clean-install && npm cache clean --force
ENTRYPOINT ["docker-entrypoint.sh"]
-FROM base as dev
+FROM builder as dev
+COPY --from=builder /usr/src/app ./app
+WORKDIR ./app
+RUN npm clean-install && npm cache clean --force
EXPOSE 8082
-CMD ["npm", "run", "dev"]
+# RUN npx turbo run dev --filter=studio
+CMD ["npx", "turbo", "run", "dev", "--filter=studio"]
-FROM base as production
-RUN npm run build && rm -rf .next/cache/webpack && npm prune --production
+FROM builder as production
+COPY --from=builder /usr/src/app ./app
+WORKDIR ./app
+RUN npm clean-install && npm cache clean --force
+RUN npx turbo run build --scope=studio --include-dependencies --no-deps
+WORKDIR ./studio
EXPOSE 3000
CMD ["npm", "run", "start"]