mirror of
https://github.com/chenasraf/dotfiles.git
synced 2026-05-17 17:28:07 +00:00
1.5 KiB
1.5 KiB
{{ pascalCase name }} Web App
Dev Requirements
- Node.js
- Yarn:
npm install -g yarn
These requirements are for development mode only.
You can run this project statically using Docker without having to install other dependencies.
Run in dev mode
Dev mode allows hot reloading of files & components, and JIT build; as opposed to AOT build + static serving.
-
Install/update project dependencies:
yarn install -
Add
.env.localfile to the repository root folder, and fill it with the correct env variables:NEXT_PUBLIC_API_BASE= NEXT_PUBLIC_MAPBOX_API_KEY= NEXT_PUBLIC_FACEBOOK_APP_ID= # to use test social app login instead of prod one in backend # (optional, automatically true in dev mode) # NEXT_PUBLIC_API_TEST=true -
Run in development mode with hot reload:
yarn dev -
Open http://localhost:3000 with your browser
Run using Docker
Add the .env.local file mentioned in "Run in dev mode" to build the Docker with the correct
environment. Then, you can build the container and run as an image:
Shell - Manual
# build
docker build -t nextjs-docker .
# run
# this docker exposes port 3000, you may forward to any other port
# (in this case 3100, to avoid conflict with dev mode run)
docker run -p 3100:3000 nextjs-docker
NPM Script - Automated
# build & run via npm scripts if you have Node.js installed
yarn build:docker
yarn start:docker