Open ainsleyclark opened 2 months ago
Hey @ainsleyclark can you share the Dockerfile you're using?
Hey, sure can it's below.
I've commented out the line that makes it work COPY --from=builder /app/node_modules ./node_modules
# From https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile
FROM node:18-alpine AS base
# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN corepack enable pnpm && pnpm i
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
ENV NEXT_TELEMETRY_DISABLED 1
RUN corepack enable pnpm && pnpm run build
# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
# Temp - SQL Lite
# COPY --from=builder /app/node_modules ./node_modules
# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
ENV PORT 3000
# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD HOSTNAME="0.0.0.0" node server.js
Discord chat in Turso:
https://discord.com/channels/933071162680958986/1270099510202335233
I haven't tested this tho.
This is not only happening in docker, I tried starting a new project running:
npx create-payload-app@3.0.0-beta.96
And when I ran pnpm dev
I got the same error on my browser when trying to access the admin.
But after a couple of tries of running pnpm i
and then pnpm dev
, it worked, specifically after restarting vscode, which to me makes no sense, but I'm just sharing my experience in case it's useful.
I'm running Node v20.17.0 on an M1 Mac.
Link to reproduction
No response
Payload Version
3.0.0-beta.73
Node Version
v18.20.2
Next.js Version
15.0.0-canary.53
Describe the Bug
I encountered an issue when trying to run a Dockerized Payload application using SQLite. The problem manifests differently on local machines and cloud platforms like Digital Ocean. Previously discussed here: https://github.com/payloadcms/payload/pull/7490#issuecomment-2269757066
Local Docker Environment: Error:
Cannot find module 'libsql'
Digital Ocean:
This seems to be related to the issue discussed here: https://github.com/tursodatabase/libsql-client-ts/issues/112
Attempted Solutions:
RUN pnpm i @libsql/linux-x64-musl
to the Dockerfile did not resolve the issue.COPY --from=builder /app/node_modules ./node_modules
to the Dockerfile's runner stage resolved the issue. However, this copies the entirenode_modules
directory, which is not ideal for image size optimization.Additional Information:
@libsql
directory, but this did not work. I didn't have time to determine the exact minimum set of packages needed.Reproduction Steps
Use Dockerfile below with a
libsql:/
connection strinAdapters and Plugins
db-sqlite