{"id":16175996,"url":"https://github.com/sebastiandg7/nx-nextjs-docker","last_synced_at":"2025-10-20T06:47:16.070Z","repository":{"id":177045874,"uuid":"659537693","full_name":"sebastiandg7/nx-nextjs-docker","owner":"sebastiandg7","description":"An Nx workspace containing a NextJS app ready to be deployed as a Docker container.","archived":false,"fork":false,"pushed_at":"2023-11-30T11:35:16.000Z","size":198,"stargazers_count":18,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T06:55:27.483Z","etag":null,"topics":["containerization","docker","dockerfile","monorepo","nextjs","nx","react","tutorial"],"latest_commit_sha":null,"homepage":"https://dev.to/sebastiandg7/nx-nextjs-docker-the-nx-way-creating-the-nextjs-application-1efl","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sebastiandg7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-28T03:47:52.000Z","updated_at":"2024-10-20T10:37:02.000Z","dependencies_parsed_at":"2024-11-02T18:11:42.614Z","dependency_job_id":null,"html_url":"https://github.com/sebastiandg7/nx-nextjs-docker","commit_stats":null,"previous_names":["sebastiandg7/nx-nextjs-docker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebastiandg7%2Fnx-nextjs-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebastiandg7%2Fnx-nextjs-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebastiandg7%2Fnx-nextjs-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebastiandg7%2Fnx-nextjs-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sebastiandg7","download_url":"https://codeload.github.com/sebastiandg7/nx-nextjs-docker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246644044,"owners_count":20810686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["containerization","docker","dockerfile","monorepo","nextjs","nx","react","tutorial"],"created_at":"2024-10-10T04:47:05.686Z","updated_at":"2025-10-20T06:47:16.042Z","avatar_url":"https://github.com/sebastiandg7.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nx + Next.js + Docker\n\nThis repository contains the code implementation of the steps described in the blog posts titled:\n\n- [Nx + NextJS + Docker - The Nx way: Creating the NextJS application](https://dev.to/sebastiandg7/nx-nextjs-docker-the-nx-way-creating-the-nextjs-application-1efl).\n- [Nx + NextJS + Docker - The Nx way: Containerizing our application](https://dev.to/sebastiandg7/nx-nextjs-docker-the-nx-way-containerizing-our-application-1mi7)\n\n## Overview\n\nThe blog post provides a detailed guide on setting up a Next.js application using Nx and Docker, following best practices and leveraging the capabilities of the Nx workspace.\n\nThe repository contains all the necessary code and configuration files to follow along with the steps outlined in the blog post.\n\n## Prerequisites\n\nTo successfully run the Next.js application and Dockerize it, ensure that you have the following dependencies installed on your system:\n\n- Docker (version 23)\n- Node.js (version 18)\n- pnpm (version 8)\n\nYou can alternatively use [Volta](https://volta.sh/) to setup the right tooling for this project.\n\n## Getting Started\n\nTo get started, follow the steps below:\n\n1. Clone the repository to your local machine:\n\n   ```bash\n   git clone https://github.com/sebastiandg7/nx-nextjs-docker.git\n   ```\n\n2. Install the project dependencies:\n\n   ```bash\n   pnpm install\n   ```\n\n3. Refer to the blog post for detailed instructions on how creating the Next.js application, setting up workspace libraries, and configuring the custom server build was done.\n\n4. Once you have completed the steps and tested your application locally, you can follow the blog post for further instructions on how building the application for production and Dockerizing it efficiently was configured.\n\n## Building the application\n\nTo build the NextJS application, run:\n\n```bash\npnpm exec nx build my-app\n```\n\nYou will find the build output in the `dist/apps/my-app` directory.\n\nTo run the production build, run:\n\n```bash\ncd dist/apps/my-app\nnode server/main.js # Using the custom server\nnpm start # Using the NextJS built-in server\n```\n\n## Containerizing the application\n\nTo build the NexJS application container, run:\n\n```bash\npnpm exec nx container my-app\n```\n\nThis will create a local image tagged as `my-app:latest`.\n\n## Running the application contianer\n\nOnce the container image is built, you can start the container by running:\n\n```bash\ndocker run -p 3000:3000 -t my-app:latest\n```\n\nVisit http://localhost:3000 to see the application running\n\n![Nx + NextJs application running from a container](https://github.com/sebastiandg7/nx-nextjs-docker/assets/13395979/7c2ef304-5168-4058-a950-4664f81fc05a)\n\nOr call the API endpoint:\n\n```bash\n➜ curl http://localhost:3000/api/hello\nHello, from API!\n```\n\n## Additional Information\n\nFor additional information and in-depth explanations of the steps involved, please refer to the blog posst:\n\n- [Nx + NextJS + Docker - The Nx way: Creating the NextJS application](https://dev.to/sebastiandg7/nx-nextjs-docker-the-nx-way-creating-the-nextjs-application-1efl).\n- [Nx + NextJS + Docker - The Nx way: Containerizing our application](https://dev.to/sebastiandg7/nx-nextjs-docker-the-nx-way-containerizing-our-application-1mi7)\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebastiandg7%2Fnx-nextjs-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsebastiandg7%2Fnx-nextjs-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebastiandg7%2Fnx-nextjs-docker/lists"}