Open arthurd2 opened 3 years ago
Oops, just did! It's not an optimal solution, but it works:
FROM node:12.20.1-stretch
ENV MAC=XXXXX
ENTRYPOINT ./am43ctrl $MAC -l 3000
EXPOSE 3000
WORKDIR /app
RUN npm install https://github.com/binsentsu/am43-ctrl
WORKDIR /app/node_modules/.bin/
Running commandi would be:
docker run -ti --net=host --privileged -p 3000 -e MAC=YYYY am43
Here is my solution with docker You have to provide the different "ENV" via -e params
FROM node:12-alpine
ENV LANG C.UTF-8
ENV NODE_ENV production`
RUN apk add --no-cache git npm python3 linux-headers eudev-dev make libusb-dev gcc g++ bash
RUN npm install https://github.com/binsentsu/am43-ctrl
RUN apk del make libusb-dev python3 gcc g++ git linux-headers eudev-dev
RUN rm -r /root/.npm
WORKDIR node_modules/.bin/
ENV URL=""
ENV MAC1=""
ENV MQTTUSER=""
ENV MQTTPWD=""
ENTRYPOINT ./am43ctrl ${MAC1} --url ${URL} -u ${MQTTUSER} -p ${MQTTPWD}´´´
Great one, the image shrank from 900MB to 440MB. I took your example and added a PORT ENV, changed the ENTRYPOINT and merged the RUN commands. After merging the RUNs the image shrank to 150MB. =D
FROM node:12-alpine
ENV LANG C.UTF-8
ENV NODE_ENV production`
ENV URL="mqtt://192.168.0.2"
ENV MAC1="XXXXXXXXXX"
ENV MQTTUSER="mqtt"
ENV PORT="3000"
ENV MQTTPWD="mqttpass"
ENTRYPOINT ./am43ctrl ${MAC1} --url ${URL} -l ${PORT} -u ${MQTTUSER} -p ${MQTTPWD}
RUN apk add --no-cache git npm python3 linux-headers eudev-dev make libusb-dev gcc g++ bash ;\
npm install https://github.com/binsentsu/am43-ctrl ;\
apk del make libusb-dev python3 gcc g++ git linux-headers eudev-dev ;\
rm -r /root/.npm
WORKDIR node_modules/.bin/
If I set up a docke rwith above command I just get
/node_modules/@abandonware/noble/lib/hci-socket/hci.js:80
this._socket = new BluetoothHciSocket();
^
Error: EAFNOSUPPORT, Address family not supported by protocol
at new Hci (/node_modules/@abandonware/noble/lib/hci-socket/hci.js:80:18)
at new NobleBindings (/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:25:15)
at module.exports (/node_modules/@abandonware/noble/lib/resolve-bindings.js:13:12)
at Object.
Can Someone help here.
Thanks
I had the same problem.
But I don't remember if I fixed it by enabling the bluetooth (it was down, in airplane mode) or I've installed the bluez
package.
Hey guys, first of all: THANK YOU! Amazing job you did there.
Second: did you guys try to pack everything inside a Docker image? I've try with the
node7
image but I had some problems with libusb... I'm still trying though....