Loading go-apps/meep-mosquitto/Dockerfile +8 −4 Changes for go-apps/meep-mosquitto/Dockerfile: 8 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -8,7 +8,11 @@ RUN mkdir -p /mosquitto/config/conf.d \ COPY data/mosquitto.conf /mosquitto/config/mosquitto.conf # Copy additional listener config COPY data/listener.conf /mosquitto/config/conf.d/listener.conf # Expose MQTT default port EXPOSE 1883 # Set custom config CMD ["/usr/sbin/mosquitto", "-c", "/mosquitto/config/mosquitto.conf"] No newline at end of file WORKDIR /usr/src/app COPY ./data /usr/src/app # Install some libraries RUN apk update && apk add curl jq RUN ls -l /usr/src/app RUN chmod +x /usr/src/app/entrypoint.sh ENTRYPOINT [ "/usr/src/app/entrypoint.sh" ] No newline at end of file go-apps/meep-mosquitto/entrypoint.sh 0 → 100644 +15 −0 Changes for go-apps/meep-mosquitto/entrypoint.sh: 15 added lines, 0 removed lines. Original line number Diff line number Diff line #!/bin/sh set -e SERVICE_NAME="meep-mosquitto" # Get the namespace from the service account NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace) # Get the token from the service account TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) echo "Token: $TOKEN" # Query the Kubernetes API to get the NodePort for the service NODE_PORT=$(curl -sSk \ -H "Authorization: Bearer $TOKEN" \ https://kubernetes.default.svc/api/v1/namespaces/$NAMESPACE/services/$SERVICE_NAME \ | jq -r '.spec.ports[0].nodePort') echo "External NodePort exposed for service [$SERVICE_NAME] in namespace [$NAMESPACE] is: $NODE_PORT" exec /usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf No newline at end of file Loading
go-apps/meep-mosquitto/Dockerfile +8 −4 Changes for go-apps/meep-mosquitto/Dockerfile: 8 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -8,7 +8,11 @@ RUN mkdir -p /mosquitto/config/conf.d \ COPY data/mosquitto.conf /mosquitto/config/mosquitto.conf # Copy additional listener config COPY data/listener.conf /mosquitto/config/conf.d/listener.conf # Expose MQTT default port EXPOSE 1883 # Set custom config CMD ["/usr/sbin/mosquitto", "-c", "/mosquitto/config/mosquitto.conf"] No newline at end of file WORKDIR /usr/src/app COPY ./data /usr/src/app # Install some libraries RUN apk update && apk add curl jq RUN ls -l /usr/src/app RUN chmod +x /usr/src/app/entrypoint.sh ENTRYPOINT [ "/usr/src/app/entrypoint.sh" ] No newline at end of file
go-apps/meep-mosquitto/entrypoint.sh 0 → 100644 +15 −0 Changes for go-apps/meep-mosquitto/entrypoint.sh: 15 added lines, 0 removed lines. Original line number Diff line number Diff line #!/bin/sh set -e SERVICE_NAME="meep-mosquitto" # Get the namespace from the service account NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace) # Get the token from the service account TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) echo "Token: $TOKEN" # Query the Kubernetes API to get the NodePort for the service NODE_PORT=$(curl -sSk \ -H "Authorization: Bearer $TOKEN" \ https://kubernetes.default.svc/api/v1/namespaces/$NAMESPACE/services/$SERVICE_NAME \ | jq -r '.spec.ports[0].nodePort') echo "External NodePort exposed for service [$SERVICE_NAME] in namespace [$NAMESPACE] is: $NODE_PORT" exec /usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf No newline at end of file