66597be8a7
### Reason for making this change https://yarnpkg.com/getting-started/qa#:~:text=yarn%2Finstall%2Dstate.,your%20workspaces%20all%20over%20again. In the official documentation of `yarn`, it is stated that `.yarn/install-state.gz` is an optimization file that developer shouldn't ever have to commit. However, currently, when running `create-next-app`, `.yarn/install-state.gz` is being commited. ### Remaining work I apologize for only modifying one template initially to initiate the discussion first. If this change is agreed upon, it should be synchronized with other `.gitignore` templates. Would it be possible to follow a similar approach as in https://github.com/vercel/next.js/pull/47241? I would appreciate any assistance in syncing this change. |
||
---|---|---|
.. | ||
docker | ||
pages | ||
public | ||
styles | ||
.dockerignore | ||
.env | ||
.env.development.sample | ||
.env.production.sample | ||
.env.staging.sample | ||
.gitignore | ||
Makefile | ||
next.config.js | ||
package.json | ||
README.md |
With Docker - Multiple Deployment Environments
This examples shows how to use Docker with Next.js and deploy to multiple environment with different env values. Based on the deployment documentation.
How to use
Execute create-next-app
with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app --example with-docker-multi-env nextjs-docker-multi-env
# or
yarn create next-app --example with-docker-multi-env nextjs-docker-multi-env
# or
pnpm create next-app --example with-docker-multi-env nextjs-docker-multi-env
Enter the values in the .env.development.sample
, .env.staging.sample
, .env.production.sample
files to be used for each environments.
Using Docker and Makefile
Development environment - for doing testing
make build-development
make start-development
Staging environment - for doing UAT testing
make build-staging
make start-staging
Production environment - for users
make build-production
make start-production
Running Locally
First, run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying pages/index.js
. The page auto-updates as you edit the file.
API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.js
.
The pages/api
directory is mapped to /api/*
. Files in this directory are treated as API routes instead of React pages.