42 lines
1.2 KiB
Docker
42 lines
1.2 KiB
Docker
|
FROM node:21-alpine AS base
|
||
|
|
||
|
FROM base AS deps
|
||
|
RUN apk add --no-cache libc6-compat
|
||
|
WORKDIR /app
|
||
|
COPY package.json yarn.lock ./
|
||
|
ENV NEXT_TELEMETRY_DISABLED 0
|
||
|
# RUN yarn install --production=true
|
||
|
RUN yarn --frozen-lockfile
|
||
|
|
||
|
|
||
|
FROM base AS builder
|
||
|
WORKDIR /app
|
||
|
COPY .env.dev.sample .env
|
||
|
COPY . .
|
||
|
ENV NEXT_TELEMETRY_DISABLED 0
|
||
|
RUN yarn upgrade
|
||
|
RUN npx prisma generate
|
||
|
RUN yarn build
|
||
|
RUN npm prune --production
|
||
|
|
||
|
FROM alpine AS runner
|
||
|
RUN apk add --no-cache nodejs
|
||
|
WORKDIR /app
|
||
|
ENV NODE_ENV production
|
||
|
RUN addgroup --system --gid 1001 nodejs
|
||
|
RUN adduser --system --uid 1001 nextjs
|
||
|
|
||
|
COPY --from=builder --chown=nextjs:nodejs /app/next.config.js ./
|
||
|
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||
|
COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json
|
||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||
|
# COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
|
||
|
# COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma
|
||
|
# COPY --from=builder --chown=nextjs:nodejs /app/start.sh .
|
||
|
|
||
|
USER nextjs
|
||
|
EXPOSE 3000
|
||
|
ENV PORT 3000
|
||
|
|
||
|
CMD ["sh", "start.sh"]
|