-
Notifications
You must be signed in to change notification settings - Fork 523
/
dev.Dockerfile
40 lines (35 loc) · 1.18 KB
/
dev.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM node:20-alpine
ARG DATABASE_URL
ARG NEXTAUTH_SECRET
ARG NEXTAUTH_URL
ARG NEXT_PUBLIC_APP_URL
ARG RESEND_API_KEY
ARG STRIPE_API_KEY
ARG NEXT_PUBLIC_STRIPE_PAYMENT_LINK
ARG NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY_LIVE
ARG NODE_ENV
ARG SERVER_URL
ARG STRIPE_SECRET_KEY_LIVE
ARG STRIPE_WEBHOOK_SECRET
WORKDIR /app
# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i; \
# Allow install without lockfile, so example works even without Node.js installed locally
else echo "Warning: Lockfile not found. It is recommended to commit lockfiles to version control." && yarn install; \
fi
COPY . .
COPY public ./public
COPY next.config.js .
COPY tsconfig.json .
RUN npx prisma generate
# Start Next.js in development mode based on the preferred package manager
CMD \
if [ -f yarn.lock ]; then yarn dev; \
elif [ -f package-lock.json ]; then npm run dev; \
elif [ -f pnpm-lock.yaml ]; then pnpm dev; \
else npm run dev; \
fi