Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added docker development environment #26669

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

captainlettuce
Copy link

@captainlettuce captainlettuce commented Mar 9, 2025

While working on the project I did so in docker, thought I'd share my config.

It's probably far from perfect, but it works. Keep it or leave it.

😄

@captainlettuce captainlettuce changed the base branch from master to dev March 9, 2025 13:47
@captainlettuce
Copy link
Author

Please re-trigger failed job, i changed the target.

RUN chmod +x /usr/local/bin/docker-entrypoint.sh

COPY . /app
RUN pnpm build
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will require rebuilding the container every time you change the container, which is not handy. I think it would be best to run npm run build:watch and an auto restart or something.

Copy link
Author

@captainlettuce captainlettuce Mar 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the container is ran with the accompanying compose-file the repository root is bind-mounted into /app so no rebuild necessary afaict.

You can still run npm run build:watch in another terminal, or with docker compose -f docker/compose.dev.yml exec zigbee2mqtt npm run build:watch for running inside the container.

A proper live-reload with the pnpm start command would probably be preferable but I'm not that comfortable with node.js unfortunately

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we can just re-use https://github.com/Koenkk/zigbee2mqtt/blob/master/docker/Dockerfile, as this separate Dockerfile add some extra maintenance. I think this can be done by specifying the target in the docker-compose.dev.yaml. Then the user just has to run pnpm start to start Z2M

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that seems doable, I'll update when i get some time

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