Skip to content

Instantly share code, notes, and snippets.

@ahmadrosid
Created November 22, 2025 03:47
Show Gist options
  • Select an option

  • Save ahmadrosid/4215db0147cceca4bfa46f13ad4ebc49 to your computer and use it in GitHub Desktop.

Select an option

Save ahmadrosid/4215db0147cceca4bfa46f13ad4ebc49 to your computer and use it in GitHub Desktop.
# ───────────────────────────────────────────
# 1. Use a stable Node LTS image (22-slim)
# This tag provides both amd64 and arm64 variants.
# BuildKit will pick the correct one for the current platform
# ───────────────────────────────────────────
FROM --platform=linux/amd64 node:22-slim
# ───────────────────────────────────────────
# 2. Minimal OS tooling
# ───────────────────────────────────────────
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
python3 \
python3-pip \
python-is-python3 \
&& rm -rf /var/lib/apt/lists/*
# Allow pip installs in Debian 12+/Ubuntu 23.04+ environment
ENV PIP_BREAK_SYSTEM_PACKAGES=1
# ───────────────────────────────────────────
# 2.1. Install Next.js CLI globally
# ───────────────────────────────────────────
RUN npm install -g next@latest eslint@latest
COPY compile_page.sh /compile_page.sh
RUN chmod +x /compile_page.sh
# ───────────────────────────────────────────
# 3. Build everything under /home/user/app
# ───────────────────────────────────────────
WORKDIR /home/user/app
# ───────────────────────────────────────────
# 4. Generate a brand‑new Next.js app with all
# *default* answers (-y) and the latest versions
# ───────────────────────────────────────────
ENV CI=true
RUN echo y | npx create-next-app@latest . --src-dir
# The pipe feeds "y" to respond to every prompt
COPY layout.tsx /home/user/app/src/app/layout.tsx
COPY next.config.ts /home/user/app/next.config.ts
# ───────────────────────────────────────────
# 5. Global UI tooling – newest shadcn/ui CLI
# The pipe feeds a "y" response so every prompt
# is answered with the default.
# ───────────────────────────────────────────
RUN echo y | npx shadcn@latest init \
&& echo y | npx shadcn@latest add --all
# ───────────────────────────────────────────
# 5.1. Configure npm to handle legacy peer deps
# ───────────────────────────────────────────
RUN npm config set legacy-peer-deps true \
&& npm config set fund false \
&& npm config set audit false
# ───────────────────────────────────────────
# 6. Copy Aceternity UI components directory into the Next.js project
# ───────────────────────────────────────────
RUN mkdir -p /home/user/app/src/components/ui
COPY ui/ /home/user/app/src/components/ui/
# ───────────────────────────────────────────
# 6.1. Copy package.json and install dependencies
# ───────────────────────────────────────────
COPY package.json /home/user/app/package.json
RUN npm install --legacy-peer-deps
RUN npm install --legacy-peer-deps motion tailwindcss-animate tw-animate-css tailwind-merge clsx lucide-react react-icons @heroicons/react framer-motion
RUN npm install --legacy-peer-deps react-fast-marquee cobe @tabler/icons-react react-rough-notation @headlessui/react react-intersection-observer
RUN npm install --legacy-peer-deps [email protected] @babel/parser @number-flow/react
RUN npm install --save-dev eslint eslint-config-next
RUN npm install --save-dev @eslint/eslintrc
# ───────────────────────────────────────────
# 7. Create libs folder and copy utils.ts
# ───────────────────────────────────────────
RUN mkdir -p /home/user/app/src/lib
COPY utils.ts /home/user/app/src/lib/utils.ts
# ───────────────────────────────────────────
# 8. Copy all blocks components into src/components/blocks
# ───────────────────────────────────────────
RUN mkdir -p /home/user/app/src/components/blocks
COPY blocks/ /home/user/app/src/components/blocks/
# ───────────────────────────────────────────
# 9. Copy visual-edits folder into src/visual-edits
# ───────────────────────────────────────────
RUN mkdir -p /home/user/app/src/visual-edits
COPY visual-edits/ /home/user/app/src/visual-edits/
# ───────────────────────────────────────────
# 10. Copy ErrorReporter.tsx into src/components
# ───────────────────────────────────────────
COPY ErrorReporter.tsx /home/user/app/src/components/ErrorReporter.tsx
COPY eslint.config.mjs /home/user/app/eslint.config.mjs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment