This is a Next.js project bootstrapped with create-next-app.
- Node.js ≥ 18 (tested with 20.x).
You can install via nodejs.org or a version manager likenvm/asdf. - npm (comes with Node) – or
yarn/pnpmif you prefer.
- Clone & install dependencies
git clone <repo-url> cd luna_frontend npm ci # or: npm install
- Create an environment file (skip if you do not need runtime variables)
• The
# .env.local – ignored by git NEXT_PUBLIC_API_URL=http://localhost:80 # your backend base URL
NEXT_PUBLIC_prefix is mandatory for variables that the browser must see.
• Anything after an un-quoted#is treated as a comment. - Start the dev server
Open http://localhost:3000 to view the app; it reloads on file save.
npm run dev
npm run build # compile for production
npm run start # start Next.js in production modeThe repository contains two Dockerfiles for different use cases:
Dockerfile (Production)
- Multi-stage build for optimized production images
- Smaller final image - only includes built assets and runtime dependencies
- Better security - runs with minimal attack surface
- Build process: dependencies → build → production runtime
- Use for: production deployments, CI/CD pipelines
dev.Dockerfile (Development)
- Single-stage build for faster iteration
- Includes all source code and development dependencies
- Hot reloading with
npm run dev - Larger image size but faster rebuild times
- Use for: local development, debugging
# The -t flag tags the image so it's easier to reference later.
# Feel free to change "luna-frontend" to whatever name you like.
docker build -t luna-frontend .# Build development image for faster iteration
docker build -f dev.Dockerfile -t luna-dev .Production:
# Map container port 3000 -> host port 3000 so you can access the app in your browser.
docker run --rm -p 3000:3000 luna-frontendDevelopment:
# Development with hot reloading
docker run --rm -p 3000:3000 -v $(pwd):/app luna-devNow visit http://localhost:3000 in your browser.
- Want a different Node.js version? Change the
FROM node:20-alpinelines. - Need environment variables (e.g. API URLs)? There are two options:
- Bake them into the image – include a
.envfile before youdocker build(the Dockerfile copies it). You'll need to rebuild any time a value changes. - Inject them at runtime – pass
-eflags or--env-filewhen you run the container, so you can reuse the same image across environments.
Runtime example:
docker run \
-e NEXT_PUBLIC_API_URL=https://api.example.com \
-e JWT_SECRET=super-secret \
-p 3000:3000 luna-frontendFor local development you can still use npm run dev outside Docker – the container is geared toward production.