Giter VIP home page Giter VIP logo

Comments (5)

Shaquu avatar Shaquu commented on September 23, 2024

I believe you need to run it (docker container) in the host mode.

from hap-nodejs.

Supereg avatar Supereg commented on September 23, 2024

It might be able to have a look at the official homebridge docker image as an inspiration https://github.com/oznu/docker-homebridge.

The primary problem, most likely, is to make sure that the mDNS advertisements reach the „outside“ of the container. That’s the reason to use the container in host mode as of right now.

from hap-nodejs.

buschco avatar buschco commented on September 23, 2024

Thanks for the replies!

In my docker-compose file I added network_mode: host and removed any other network, ports and expose entries.

To access the container from another service, this might help https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach

extra_hosts:
      - "host.docker.internal:host-gateway"

and access via host.docker.internal:<port>

from hap-nodejs.

guilhermelirio avatar guilhermelirio commented on September 23, 2024

Hi @buschco

Could you share how your dockerfile or docker-compose turned out, please?

I'm facing the same problem.

from hap-nodejs.

buschco avatar buschco commented on September 23, 2024

@guilhermelirio

docker-compose.yml

  air:
    tty: true
    stdin_open: true
    image: buschco/esp-air-reporter
    restart: always
    network_mode: host
    volumes:
      - persist:/persist

Dockerfile

FROM node:18-alpine AS builder

COPY package.json .
COPY index.ts .
COPY yarn.lock .

RUN yarn install --frozen-lockfile
RUN yarn build

FROM node:18-alpine AS runner

COPY --from=builder out/index.js .

EXPOSE 3031 51826

CMD [ "node", "index.js", "3031", "51826"]

index.ts

//...
const httpPort = parseInt(process.argv[2], 10) || 8080;
const homeKitPort = parseInt(process.argv[3], 10) || 51827;

bridge.publish({
  username: "0C:4E:19:2C:A3:82",
  pincode: "210-21-998",
  port: homeKitPort,
});

from hap-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.