FROM nodered/node-red:latest ARG MQTT_URL ARG MYSQL_URL ARG MYSQL_DATABASE ARG INFLUXDB_USER ARG INFLUXDB_USER_PASSWORD ARG INFLUXDB_DB ARG INFLUX_URL ENV MQTT_URL $MQTT_URL ENV MYSQL_URL $MYSQL_URL ENV MYSQL_DATABASE $MYSQL_DATABASE ENV INFLUXDB_USER $INFLUXDB_USER ENV INFLUXDB_USER_PASSWORD $INFLUXDB_USER_PASSWORD ENV INFLUXDB_DB $INFLUXDB_DB ENV INFLUX_URL $INFLUX_URL RUN chown 1000:1000 /data COPY --chown=1000:1000 rootfs/data /data RUN sed -i 's/iot.valki.com/'"$MQTT_URL"'/g' /data/flows.json RUN sed -i 's/\"db.valki.com\"/\"'"$MYSQL_URL"\"'/g' /data/flows.json RUN sed -i 's/nodered/'"$MYSQL_DATABASE"'/g' /data/flows.json RUN sed -i 's/influxdb.valki.com/'"$INFLUX_URL"'/g' /data/flows.json RUN sed -i 's/\"database\":\"openAger\"/\"database\":\"'"$INFLUXDB_DB"\"'/g' /data/flows.json