Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bjarneo/nextjs-dockerfile

A generic dockerfile for Next.js
https://github.com/bjarneo/nextjs-dockerfile

Last synced: 3 days ago
JSON representation

A generic dockerfile for Next.js

Awesome Lists containing this project

README

        

## Recommendation
Follow the docker image setup provided by the official docs: https://nextjs.org/docs/app/building-your-application/deploying#docker-image. Remember to add this for the standalone version: https://nextjs.org/docs/app/api-reference/next-config-js/output#automatically-copying-traced-files

# Next.js Dockerfile
Copy the `Dockerfile` to the root of your project.

## Note
This dockerfile is generic and would work for most of the next.js applications out there.

## Build and run locally
```bash
docker build -t .

docker run -it -p 3000:3000 --rm --name

# Need to inject .env file?
# Add this to the run command:
# -v /host/path/.env:/app/.env
docker run -it -p 3000:3000 -v /host/path/.env:/app/.env --rm --name
```

## Improvements
Most likely the file can be improved even more. Feel free to add a PR.