59 lines
1.5 KiB
Docker
59 lines
1.5 KiB
Docker
# Coolify production image: Next.js standalone app with Blender for Draco compression.
|
|
|
|
# --- Stage 1: Dependencies ---------------------------------------------------
|
|
FROM node:20-slim AS deps
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json package-lock.json* .npmrc ./
|
|
RUN npm ci --ignore-scripts --no-audit --no-fund
|
|
|
|
# --- Stage 2: Build ----------------------------------------------------------
|
|
FROM node:20-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
ENV NODE_ENV=production
|
|
|
|
RUN npm run build
|
|
|
|
# --- Stage 3: Production -----------------------------------------------------
|
|
FROM node:20-slim AS runner
|
|
|
|
LABEL maintainer="La Fabrik Durable"
|
|
LABEL description="Secure GLTF upload interface with Draco compression and Git push"
|
|
|
|
# Blender is required for server-side Draco GLB export.
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
blender \
|
|
tini \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
ENV PORT=3000
|
|
ENV HOSTNAME=0.0.0.0
|
|
|
|
COPY --from=builder /app/.next/standalone ./
|
|
COPY --from=builder /app/.next/static ./.next/static
|
|
COPY --from=builder /app/public ./public
|
|
|
|
COPY --from=builder /app/scripts ./scripts
|
|
|
|
RUN mkdir -p /tmp/assets
|
|
|
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
|
RUN chmod +x /docker-entrypoint.sh
|
|
|
|
EXPOSE 3000
|
|
|
|
ENTRYPOINT ["/usr/bin/tini", "--", "/docker-entrypoint.sh"]
|
|
CMD ["node", "server.js"]
|