Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🚀 Remove corepack dependency from docker image (#2181)

Luke Vella7e005b92cd10
diff --git a/.env.development b/.env.development
index 14fb5c81d..90d0e02ab 100644
--- a/.env.development
+++ b/.env.development
@@ -5,9 +5,6 @@ SECRET_PASSWORD=abcdef1234567890abcdef1234567890
# Example: https://example.com
NEXT_PUBLIC_BASE_URL=http://localhost:3000
-# AUTH_URL should be the same as NEXT_PUBLIC_BASE_URL
-AUTH_URL=http://localhost:3000
-
# A connection string to your Postgres database
DATABASE_URL="postgres://postgres:postgres@localhost:5450/rallly"
diff --git a/apps/web/.env.test b/apps/web/.env.test
index 6ca49f474..8112015e0 100644
--- a/apps/web/.env.test
+++ b/apps/web/.env.test
@@ -1,7 +1,6 @@
NODE_ENV=test
PORT=3002
NEXT_PUBLIC_BASE_URL=http://localhost:3002
-AUTH_URL=$NEXT_PUBLIC_BASE_URL
SECRET_PASSWORD=abcdef1234567890abcdef1234567890
DATABASE_URL=postgres://postgres:postgres@localhost:5450/rallly
diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile
index 8b7680c53..6421d43d4 100644
--- a/apps/web/Dockerfile
+++ b/apps/web/Dockerfile
@@ -1,14 +1,11 @@
-# Base stage with Node.js 24 and Corepack enabled
FROM node:24 AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
-# Slim base stage with Node.js 24 and Corepack enabled
FROM node:24-slim AS base-slim
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
-RUN corepack enable
# --- Builder Stage ---
FROM base AS builder
@@ -57,43 +54,34 @@ RUN apt-get update \
WORKDIR /app
-# Install prisma globally needed for runtime operations like migrations
-RUN pnpm add -g prisma@7
-
# Don't run production as root
RUN addgroup --system nodejs \
&& adduser --system --ingroup nodejs --home /app --shell /bin/bash nextjs
-# Copy Corepack cache from installer stage to avoid runtime download
-COPY --chown=nextjs:nodejs --from=installer /root/.cache/node/corepack/ /app/.cache/node/corepack/
+# Install prisma for runtime migrations (must be resolvable from /app)
+RUN npm add prisma@7
-# Copy app files
+# Copy prisma schema and config for migrations
COPY --from=builder /app/scripts/docker-start.sh ./
COPY --from=builder /app/packages/database/prisma ./prisma
COPY --from=builder /app/packages/database/prisma.config.ts ./
-COPY --from=installer /app/apps/web/next.config.ts .
-COPY --from=installer /app/apps/web/package.json .
# Copy Next.js standalone output
COPY --chown=nextjs:nodejs --from=installer /app/apps/web/.next/standalone ./
COPY --chown=nextjs:nodejs --from=installer /app/apps/web/.next/static ./apps/web/.next/static
COPY --chown=nextjs:nodejs --from=installer /app/apps/web/public ./apps/web/public
-# Fix ownership of global pnpm dir - Prisma needs write access to its engines
-# and cache directories within the pnpm global store at runtime
-RUN chown -R nextjs:nodejs /pnpm
-ENV HOME=/app
USER nextjs
-EXPOSE 3000
+ENV HOME=/app
ENV PORT=3000
+ENV HOSTNAME=0.0.0.0
+ENV LOG_LEVEL=warn
ARG SELF_HOSTED
ENV NEXT_PUBLIC_SELF_HOSTED=$SELF_HOSTED
-ENV HOSTNAME=0.0.0.0
-# Set default log level to warning
-ENV LOG_LEVEL=warn
+EXPOSE 3000
HEALTHCHECK CMD curl --fail http://localhost:${PORT}/api/status || exit 1
diff --git a/packages/database/package.json b/packages/database/package.json
index 5e2d31aa7..292e99682 100644
--- a/packages/database/package.json
+++ b/packages/database/package.json
@@ -7,6 +7,7 @@
"db:push": "prisma db push --skip-generate",
"db:deploy": "prisma migrate deploy",
"db:migrate": "prisma migrate dev --skip-generate",
+ "db:reset": "prisma migrate reset",
"db:seed": "tsx prisma/seed.ts",
"type-check": "tsc --pretty --noEmit"
},
@@ -18,7 +19,6 @@
"@prisma/client": "^7.3.0",
"@vercel/functions": "^3.3.6",
"dayjs": "^1.11.13",
- "dotenv": "^17.2.4",
"pg": "^8.17.1"
},
"devDependencies": {
diff --git a/packages/database/prisma.config.ts b/packages/database/prisma.config.ts
index 0cead7fa4..144a2bd00 100644
--- a/packages/database/prisma.config.ts
+++ b/packages/database/prisma.config.ts
@@ -1,9 +1,11 @@
import path from "node:path";
-import dotenv from "dotenv";
import { defineConfig } from "prisma/config";
-// Load .env from monorepo root
-dotenv.config({ path: path.join(__dirname, "../../.env") });
+try {
+ process.loadEnvFile(path.join(__dirname, "../../.env"));
+} catch {
+ console.info("No .env file found, continuing without it");
+}
export default defineConfig({
schema: path.join(__dirname, "prisma"),
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 603283b60..4a9118244 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -83,7 +83,7 @@ importers:
version: 8.1.0([email protected])
'@vercel/analytics':
specifier: ^1.5.0
dayjs:
specifier: ^1.11.13
version: 1.11.19
@@ -122,7 +122,7 @@ importers:
version: 5.0.0(@types/[email protected])([email protected])
next-seo:
specifier: ^6.1.0
pg:
specifier: ^8.17.1
version: 8.18.0
@@ -552,9 +552,6 @@ importers:
dayjs:
specifier: ^1.11.13
version: 1.11.19
- dotenv:
- specifier: ^17.2.4
- version: 17.2.4
pg:
specifier: ^8.17.1
version: 8.18.0
@@ -15967,7 +15964,7 @@ snapshots:
dependencies:
uncrypto: 0.1.3
optionalDependencies:
react: 19.2.4
@@ -19698,7 +19695,7 @@ snapshots:
react: 19.2.4
react-dom: 19.2.4([email protected])
dependencies:
react: 19.2.4
diff --git a/scripts/docker-start.sh b/scripts/docker-start.sh
index 4a60c1bd2..c2f232ee2 100755
--- a/scripts/docker-start.sh
+++ b/scripts/docker-start.sh
@@ -1,8 +1,8 @@
#!/bin/sh
set -e
-export DIRECT_DATABASE_URL=$DATABASE_URL
+# Needed by next-auth to verify the origin of the request
export AUTH_URL=$NEXT_PUBLIC_BASE_URL
-pnpm prisma migrate deploy --config=./prisma.config.ts
+npx prisma migrate deploy --config=./prisma.config.ts
node apps/web/server.js