Skip to content

Conversation

@WH1TE-SHAD0W
Copy link
Contributor

It took me a while as I haven't been doing anykind of a similar project to understand how Nitro, Nuxt works. Although I have successfully been able to create docker compose with profiles for different usecases and a multistage Dockerfile. I really enjoyed doing it. Thanks for experience and I look forward for next contributions and hope you like this one.

See below for changes.

Docker support and configuration:

  • Added a multi-stage Dockerfile with separate targets for development, production, and database migration, enabling efficient builds and environment-specific containers.
  • Introduced a docker-compose.yaml file to orchestrate services for Postgres, Redis, development, production, and migration, with appropriate environment variables, volumes, and dependencies.
  • Added a .dockerignore file to exclude unnecessary files and directories (like node_modules, .idea, tests, .nuxt, and ios) from Docker build context, reducing image size.
  • For comparison nitro-dev image ended up being 2.35GB compared to prod 236MB.

Environment and documentation updates:

  • Updated .env.example to include required Postgres environment variables (POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB) for Docker Compose compatibility.
  • Expanded the README.md with detailed instructions for running the application using Docker and Docker Compose, including migration and production deployment steps.

… and development, added steps on how to run it into README.md
@productdevbook
Copy link
Owner

It's great, there's no need to migrate db. Because I'll do an automatic migration. I'll write a Nitrojs plugin.

@productdevbook productdevbook changed the title Docker deployment feat: docker deployment Aug 18, 2025
@WH1TE-SHAD0W
Copy link
Contributor Author

Okay get it, that way it's even better.

@productdevbook
Copy link
Owner

dockerhub first test please check.

- Add GitHub Actions workflow for automated Docker Hub publishing
- Increase Node.js heap size to fix build memory issues
- Update docker-compose.yaml to use published image
- Support multi-platform builds (linux/amd64, linux/arm64)
@productdevbook
Copy link
Owner

Please check the codes I sent again and adjust them as you wish, then let's proceed.

- Add comprehensive .dockerignore rules to exclude unnecessary files
- Reduce build context from ~5.59MB to ~534KB (90% reduction)
- Exclude Git, documentation, test files, and mobile SDKs from Docker image
- Improve build performance and security by filtering sensitive files
- Maintain required files like package.json and pnpm-lock.yaml for builds
@WH1TE-SHAD0W
Copy link
Contributor Author

Okay I will check it out.

WH1TE-SHAD0W and others added 5 commits August 18, 2025 13:51
… and development, added steps on how to run it into README.md
- Add GitHub Actions workflow for automated Docker Hub publishing
- Increase Node.js heap size to fix build memory issues
- Update docker-compose.yaml to use published image
- Support multi-platform builds (linux/amd64, linux/arm64)
- Add comprehensive .dockerignore rules to exclude unnecessary files
- Reduce build context from ~5.59MB to ~534KB (90% reduction)
- Exclude Git, documentation, test files, and mobile SDKs from Docker image
- Improve build performance and security by filtering sensitive files
- Maintain required files like package.json and pnpm-lock.yaml for builds
@WH1TE-SHAD0W
Copy link
Contributor Author

I went through the github actions yaml file you added. It is pretty neat, something that I wanted to make as a next step. I have removed the migrate container from my docker compose as well as the migration stage in Dockerfile.

@productdevbook productdevbook merged commit 6fd0894 into productdevbook:main Aug 19, 2025
@productdevbook
Copy link
Owner

Great, thank you ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants