Closed dkjsj closed 4 years ago
I have constructed the following Dockerfile (might be more simple... But):
############### # BUILD IMAGE # ############### FROM nimlang/nim:latest AS build ## set working directory WORKDIR /tmp # install dependencies, bundle assets, compile RUN nimble refresh # Get nMQTT Master and Eloverblik from GitHub RUN git clone https://github.com/zevv/nmqtt \ && cd nmqtt \ && nimble -y install \ && cd .. \ && git clone https://github.com/ThomasTJdev/nim_eloverblik_api \ && cd nim_eloverblik_api \ && nim c -d:ssl -d:release eloverblik.nim \ && mkdir -p /dist/eloverblik \ && mv eloverblik /dist/eloverblik ################# # RUNTIME IMAGE # ################# FROM nimlang/nim:latest AS deploy ENV NIMBLE_DIR=/home/nim/.nimble ENV PATH=$PATH:/home/nim/.nimble/bin ENV PATH $PATH:/nim/bin:/root/.nimble/bin # Copy App COPY --from=build /dist/eloverblik/ /usr/app/eloverblik/ # Default Config.cfg ADD ./files/config.cfg /usr/app/eloverblik/config/config.cfg ## add user RUN addgroup --system nim && adduser --system --group nim RUN chown -R nim:nim /usr/app && chmod -R 755 /usr/app ## Workdir App ## WORKDIR /usr/app/eloverblik ## switch to non-root user USER nim ## Start App ## CMD ["./eloverblik"]
With the config.cfg file:
[MQTT] host = "server" port = "1883" username = "" password = "" topic = "eloverblik" ssl = "false" clientname = "eloverblik" [Eloverblik] refreshToken = "token" meeteringPoint = "1" # only 1 meeteringpoint is supported. runOnBoot = "true" # will call the api when the program is started [Periode] daysBack = "1;7;365" aggregationBack = "Hour;Day;Month"
Running the Container, it fails with:
docker run --rm eloverblik connecting to server:1883 fatal.nim(49) sysFatal asyncfutures.nim(383) read asyncfutures.nim(383) read Error: unhandled exception: json.nim(465, 9) `node.kind == JObject` [AssertionError]
Any clues what that means?
My mistake. Was missing the meetering ID ...
I have constructed the following Dockerfile (might be more simple... But):
With the config.cfg file:
Running the Container, it fails with:
Any clues what that means?