mirror of
https://github.com/nicetry247/offlineacademy.git
synced 2026-08-19 06:57:57 +00:00
initial commit
This commit is contained in:
+54
@@ -0,0 +1,54 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# -----------------------------
|
||||
# Dependencies
|
||||
# -----------------------------
|
||||
FROM node:22-bookworm-slim AS deps
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci --no-audit --no-fund
|
||||
|
||||
# -----------------------------
|
||||
# Build
|
||||
# -----------------------------
|
||||
FROM node:22-bookworm-slim AS builder
|
||||
WORKDIR /app
|
||||
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
RUN npx prisma generate
|
||||
RUN npm run build
|
||||
|
||||
# -----------------------------
|
||||
# Runtime
|
||||
# -----------------------------
|
||||
FROM node:22-bookworm-slim AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
ENV PORT=6767
|
||||
ENV HOSTNAME=0.0.0.0
|
||||
|
||||
RUN groupadd --system --gid 1001 nodejs \
|
||||
&& useradd --system --uid 1001 --gid nodejs nextjs
|
||||
|
||||
# Next.js standalone output
|
||||
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/public ./public
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma
|
||||
|
||||
# Runtime writable folders. Users can bind-mount these from anywhere.
|
||||
RUN mkdir -p /app/My_Courses /app/prisma \
|
||||
&& chown -R nextjs:nodejs /app/My_Courses /app/prisma
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 6767
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
Reference in New Issue
Block a user