Skip to content

Instantly share code, notes, and snippets.

@julianapeace
Created September 24, 2025 19:43
Show Gist options
  • Save julianapeace/70a562c08a34d8101bb3b75fc63ed59c to your computer and use it in GitHub Desktop.
Save julianapeace/70a562c08a34d8101bb3b75fc63ed59c to your computer and use it in GitHub Desktop.
Discord challenge #2 - This dockerfile will not build on NodeOps. What is wrong with it?
# Use Node.js 24 slim for ARM64 architecture
FROM --platform=linux/arm64 node:24-slim AS base
# Install dependencies only when needed
FROM base AS deps
WORKDIR /app
# Copy package files first
COPY package.json package-lock.json* ./
# Install dependencies
RUN npm install
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Build the application
RUN npm run build
# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
# Copy built application
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
# Use node to run the standalone server
CMD ["node", "server.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment