mirror of
https://github.com/lukevella/rallly.git
synced 2025-08-06 09:59:00 +02:00
Working Dockerfile
This commit is contained in:
parent
b568daa201
commit
0f30208427
7 changed files with 30 additions and 16 deletions
|
@ -11,3 +11,11 @@ docker-compose.yml
|
||||||
/docs
|
/docs
|
||||||
README.md
|
README.md
|
||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
|
# Build outputs
|
||||||
|
apps/*/.next
|
||||||
|
apps/*/dist
|
||||||
|
packages/*/dist
|
||||||
|
|
||||||
|
# Turbo prune output
|
||||||
|
out/
|
||||||
|
|
|
@ -21,11 +21,10 @@ RUN turbo prune --scope=@rallly/web --docker
|
||||||
# --- Installer Stage ---
|
# --- Installer Stage ---
|
||||||
FROM base AS installer
|
FROM base AS installer
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY .gitignore .gitignore
|
|
||||||
COPY package.json .
|
COPY package.json .
|
||||||
COPY --from=builder /app/out/json/ .
|
COPY --from=builder /app/out/json/ .
|
||||||
COPY --from=builder /app/out/pnpm-lock.yaml ./
|
COPY --from=builder /app/out/pnpm-lock.yaml ./
|
||||||
RUN pnpm install --frozen-lockfile
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||||
|
|
||||||
# Build the project
|
# Build the project
|
||||||
COPY --from=builder /app/out/full/ .
|
COPY --from=builder /app/out/full/ .
|
||||||
|
@ -58,17 +57,17 @@ RUN apt-get update \
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package.json .
|
|
||||||
# Install prisma globally needed for runtime operations like migrations
|
|
||||||
RUN pnpm add -g prisma
|
|
||||||
|
|
||||||
# Don't run production as root
|
# Don't run production as root
|
||||||
RUN addgroup --system --gid 1001 nodejs
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
RUN adduser --system --uid 1001 nextjs
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
# Set HOME env for non-root user
|
||||||
|
ENV HOME=/app
|
||||||
|
# Ensure /app is writable by nextjs user
|
||||||
|
RUN chown -R nextjs:nodejs /app
|
||||||
USER nextjs
|
USER nextjs
|
||||||
|
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/scripts/docker-start.sh ./
|
COPY --from=builder /app/scripts/docker-start.sh ./
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/packages/database/prisma ./prisma
|
COPY --from=builder /app/packages/database/prisma ./prisma
|
||||||
COPY --from=installer /app/apps/web/next.config.js .
|
COPY --from=installer /app/apps/web/next.config.js .
|
||||||
COPY --from=installer /app/apps/web/package.json .
|
COPY --from=installer /app/apps/web/package.json .
|
||||||
|
|
||||||
|
@ -76,9 +75,9 @@ ENV PORT=3000
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
# Copy Next.js standalone output
|
# Copy Next.js standalone output
|
||||||
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalone ./
|
COPY --from=installer /app/apps/web/.next/standalone ./
|
||||||
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static
|
COPY --from=installer /app/apps/web/.next/static ./apps/web/.next/static
|
||||||
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public
|
COPY --from=installer /app/apps/web/public ./apps/web/public
|
||||||
|
|
||||||
ARG SELF_HOSTED
|
ARG SELF_HOSTED
|
||||||
ENV NEXT_PUBLIC_SELF_HOSTED=$SELF_HOSTED
|
ENV NEXT_PUBLIC_SELF_HOSTED=$SELF_HOSTED
|
||||||
|
|
|
@ -102,6 +102,7 @@
|
||||||
"@types/color-hash": "^1.0.2",
|
"@types/color-hash": "^1.0.2",
|
||||||
"@types/js-cookie": "^3.0.1",
|
"@types/js-cookie": "^3.0.1",
|
||||||
"@types/lodash": "^4.14.178",
|
"@types/lodash": "^4.14.178",
|
||||||
|
"@types/node": "^18.19.41",
|
||||||
"@types/react": "^18.2.0",
|
"@types/react": "^18.2.0",
|
||||||
"@types/react-big-calendar": "^1.8.8",
|
"@types/react-big-calendar": "^1.8.8",
|
||||||
"@types/react-dom": "^18.2.0",
|
"@types/react-dom": "^18.2.0",
|
||||||
|
|
|
@ -33,10 +33,6 @@
|
||||||
"seed": "pnpm --filter @rallly/database db:seed",
|
"seed": "pnpm --filter @rallly/database db:seed",
|
||||||
"schema": "./packages/database/prisma/schema.prisma"
|
"schema": "./packages/database/prisma/schema.prisma"
|
||||||
},
|
},
|
||||||
"workspaces": [
|
|
||||||
"apps/*",
|
|
||||||
"packages/*"
|
|
||||||
],
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "^1.49.1",
|
"@playwright/test": "^1.49.1",
|
||||||
"dotenv-cli": "^8.0.0",
|
"dotenv-cli": "^8.0.0",
|
||||||
|
|
|
@ -7,5 +7,9 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@heroicons/react": "^1.0.6",
|
"@heroicons/react": "^1.0.6",
|
||||||
"lucide-react": "^0.479.0"
|
"lucide-react": "^0.479.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
6
pnpm-lock.yaml
generated
6
pnpm-lock.yaml
generated
|
@ -406,6 +406,9 @@ importers:
|
||||||
'@types/lodash':
|
'@types/lodash':
|
||||||
specifier: ^4.14.178
|
specifier: ^4.14.178
|
||||||
version: 4.17.16
|
version: 4.17.16
|
||||||
|
'@types/node':
|
||||||
|
specifier: ^18.19.41
|
||||||
|
version: 18.19.87
|
||||||
'@types/react':
|
'@types/react':
|
||||||
specifier: ^18.2.0
|
specifier: ^18.2.0
|
||||||
version: 18.3.20
|
version: 18.3.20
|
||||||
|
@ -583,6 +586,9 @@ importers:
|
||||||
react:
|
react:
|
||||||
specifier: ^18.2.0
|
specifier: ^18.2.0
|
||||||
version: 18.3.1
|
version: 18.3.1
|
||||||
|
react-dom:
|
||||||
|
specifier: ^18.2.0
|
||||||
|
version: 18.3.1(react@18.3.1)
|
||||||
|
|
||||||
packages/languages:
|
packages/languages:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
|
@ -4,5 +4,5 @@ set -e
|
||||||
export DIRECT_DATABASE_URL=$DATABASE_URL
|
export DIRECT_DATABASE_URL=$DATABASE_URL
|
||||||
export AUTH_URL=$NEXT_PUBLIC_BASE_URL
|
export AUTH_URL=$NEXT_PUBLIC_BASE_URL
|
||||||
|
|
||||||
prisma migrate deploy --schema=./prisma/schema.prisma
|
pnpm dlx prisma migrate deploy --schema=./prisma/schema.prisma
|
||||||
node apps/web/server.js
|
node apps/web/server.js
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue