Skip to content

Commit

Permalink
Update config in Dockerfile (DennisOSRM#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisOSRM authored and Joerg committed Dec 21, 2023
1 parent 189413f commit fb0d22e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ FROM debian:bullseye-slim
# Copy the installed application from the build image to the smaller image.
COPY --from=builder /usr/local/cargo/bin/hms-mqtt-publish /usr/local/bin/hms-mqtt-publish

# Generate the config file from given environment variables
RUN echo "inverter_host = \"$INVERTER_HOST\" \n\n[home_assistent] \nhost = \"$MQTT_BROKER_HOST\"\nusername = \"$MQTT_USERNAME\"\npassword = \"$MQTT_PASSWORD\"\nport = $MQTT_PORT\n" > config.toml
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh

# Run the application
CMD hms-mqtt-publish
ENTRYPOINT [ "bin/sh", "/usr/local/bin/entrypoint.sh"]
18 changes: 18 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

# Generate the config file from given environment variables

cat << EOF > config.toml
inverter_host = "$INVERTER_HOST"
[home_assistant]
host = "$MQTT_BROKER_HOST"
username = "$MQTT_USERNAME"
password = "$MQTT_PASSWORD"
port = $MQTT_PORT
EOF

# start mqtt publisher
hms-mqtt-publish

0 comments on commit fb0d22e

Please sign in to comment.