diff --git a/.env b/.env index 421623b..4e4076a 100644 --- a/.env +++ b/.env @@ -14,7 +14,7 @@ COAP_NEGOTIATION_PORT_OUT=5684 SMART_HOME_SMART_CLOCK_PORT_OUT=5685 TRAEFIK_DASHBOARD_PORT_OUT=8080 -HOSTNAME="localhost" +STACK_HOSTNAME="localhost" BROKER_URI="test.mosquitto.org" # OAUTH & GITHUB FORWARD AUTH @@ -40,4 +40,6 @@ LOKI_PORT=3100 HC_INTERVAL=40s HC_TIMEOUT=30s HC_RETRIES=3 -HC_START_PERIOD=60s \ No newline at end of file +HC_START_PERIOD=60s + +CONFIG_FILEPATH=/Users/hasanheroglu/Desktop/wot/test-things/conf \ No newline at end of file diff --git a/conf/grafana/provisioning/datasources/datasource.yml b/conf/grafana/provisioning/datasources/datasource.yml index 2f7dfe2..a2eb8ee 100644 --- a/conf/grafana/provisioning/datasources/datasource.yml +++ b/conf/grafana/provisioning/datasources/datasource.yml @@ -2,9 +2,16 @@ apiVersion: 1 datasources: - name: prometheus-datasource - uid: adwznwwq8yupse #THIS IS IMPORTANT ON THE DASHBOARD MUST BE THE SAME + uid: adwznwwq8yupse # THIS IS IMPORTANT ON THE DASHBOARD MUST BE THE SAME orgId: 1 type: prometheus access: proxy url: http://prometheus:${PROMETHEUS_PORT} isDefault: true + - name: loki-datasource + uid: cdxkxyq1xjmyoc # THIS IS IMPORTANT ON THE DASHBOARD MUST BE THE SAME + orgId: 1 + type: loki + access: proxy + url: http://loki:${LOKI_PORT} + isDefault: false diff --git a/docker-compose-infra.yml b/docker-compose-infra.yml index 68b0ec7..baa8be5 100644 --- a/docker-compose-infra.yml +++ b/docker-compose-infra.yml @@ -4,7 +4,7 @@ services: image: traefik:v3.0 labels: - traefik.enable=true - - traefik.http.routers.mydashboard.rule=Host(`traefik.${HOSTNAME}`) + - traefik.http.routers.mydashboard.rule=Host(`traefik.${STACK_HOSTNAME}`) - traefik.http.routers.mydashboard.service=api@internal - traefik.http.routers.mydashboard.middlewares=test-things-auth command: @@ -37,6 +37,8 @@ services: reservations: cpus: "0.05" memory: 50M + networks: + - things_network test-things-auth: image: thomseddon/traefik-forward-auth:2 environment: @@ -55,13 +57,15 @@ services: - "traefik.http.middlewares.test-things-auth.forwardauth.address=http://test-things-auth:${FORWARD_AUTH_PORT}" - "traefik.http.middlewares.test-things-auth.forwardauth.authResponseHeaders=X-Forwarded-User" - "traefik.http.services.test-things-auth.loadbalancer.server.port=${FORWARD_AUTH_PORT}" + networks: + - things_network prometheus: image: prom/prometheus volumes: - "prometheus_data:/prometheus" - - "./conf/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml" + - "${CONFIG_FILEPATH}/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml" labels: - - "traefik.http.routers.prometheus.rule=Host(`prometheus.${HOSTNAME}`)" + - "traefik.http.routers.prometheus.rule=Host(`prometheus.${STACK_HOSTNAME}`)" - "traefik.http.routers.prometheus.service=prometheus" - "traefik.http.routers.prometheus.middlewares=test-things-auth" - "traefik.http.services.prometheus.loadbalancer.server.port=${PROMETHEUS_PORT}" @@ -75,19 +79,21 @@ services: memory: 100M depends_on: - cadvisor + networks: + - things_network grafana: image: grafana/grafana environment: - PROMETHEUS_PORT=${PROMETHEUS_PORT} - - GF_SERVER_DOMAIN=grafana.${HOSTNAME} - - GF_SERVER_ROOT_URL=http://grafana.${HOSTNAME} + - GF_SERVER_DOMAIN=grafana.${STACK_HOSTNAME} + - GF_SERVER_ROOT_URL=http://grafana.${STACK_HOSTNAME} - LOKI_PORT=${LOKI_PORT} volumes: - - ./conf/grafana/provisioning:/etc/grafana/provisioning - - ./conf/grafana/dashboards:/var/lib/grafana/dashboards + - ${CONFIG_FILEPATH}/grafana/provisioning:/etc/grafana/provisioning + - ${CONFIG_FILEPATH}/grafana/dashboards:/var/lib/grafana/dashboards - grafana_data:/var/lib/grafana labels: - - "traefik.http.routers.grafana.rule=Host(`grafana.${HOSTNAME}`)" + - "traefik.http.routers.grafana.rule=Host(`grafana.${STACK_HOSTNAME}`)" - "traefik.http.routers.grafana.service=grafana" - "traefik.http.services.grafana.loadbalancer.server.port=${GRAFANA_PORT}" deploy: @@ -100,11 +106,13 @@ services: memory: 50M depends_on: - prometheus + networks: + - things_network cadvisor: image: gcr.io/cadvisor/cadvisor:latest container_name: cadvisor labels: - - "traefik.http.routers.cadvisor.rule=Host(`cadvisor.${HOSTNAME}`)" + - "traefik.http.routers.cadvisor.rule=Host(`cadvisor.${STACK_HOSTNAME}`)" - "traefik.http.routers.cadvisor.service=cadvisor" - "traefik.http.routers.cadvisor.middlewares=test-things-auth" - "traefik.http.services.cadvisor.loadbalancer.server.port=${CADVISOR_PORT}" @@ -121,6 +129,8 @@ services: reservations: cpus: "0.05" memory: 100M + networks: + - things_network depends_on: - coap-calculator-simple - coap-calculator-content-negotiation @@ -150,19 +160,26 @@ services: loki: image: grafana/loki:2.9.2 # labels: - # - "traefik.http.routers.loki.rule=Host(`loki.${HOSTNAME}`)" + # - "traefik.http.routers.loki.rule=Host(`loki.${STACK_HOSTNAME}`)" # - "traefik.http.routers.loki.service=loki" # - "traefik.http.services.loki.loadbalancer.server.port=${LOKI_PORT}" ports: - "3100:3100" volumes: - - ./conf/loki/loki-config.yaml:/etc/loki/local-config.yaml + - ${CONFIG_FILEPATH}/loki/loki-config.yaml:/etc/loki/local-config.yaml + networks: + - things_network promtail: image: grafana/promtail:2.9.2 volumes: - /var/log:/var/log - - ./conf/promtail/promtail-config.yaml:/etc/promtail/config.yaml + - ${CONFIG_FILEPATH}/promtail/promtail-config.yaml:/etc/promtail/config.yaml + networks: + - things_network volumes: prometheus_data: grafana_data: - portainer_data: +networks: + things_network: + name: things_network + driver: "bridge" diff --git a/docker-compose-things.yml b/docker-compose-things.yml index 4bf184f..e9d8e07 100644 --- a/docker-compose-things.yml +++ b/docker-compose-things.yml @@ -1,15 +1,12 @@ -version: "3" services: coap-calculator-simple: + image: thingweb/test-things-coap-calculator-simple labels: - traefik.udp.routers.coap-calculator-simple.entrypoints=coap-calculator-simple - build: - context: ./things/calculator/ - dockerfile: ./coap/js/Dockerfile-simple - args: - - PORT_ARG=${COAP_SIMPLE_PORT_OUT} + - traefik.udp.services.coap-calculator-simple.loadbalancer.server.port=${COAP_SIMPLE_PORT_OUT} environment: - - HOSTNAME=${HOSTNAME} + - HOSTNAME=${STACK_HOSTNAME} + - PORT=${COAP_SIMPLE_PORT_OUT} deploy: resources: limits: @@ -18,16 +15,16 @@ services: reservations: cpus: "0.01" memory: 25M + networks: + - things_network coap-calculator-content-negotiation: + image: thingweb/test-things-coap-calculator-content-negotiation labels: - traefik.udp.routers.coap-calculator-content-negotiation.entrypoints=coap-calculator-content-negotiation - build: - context: ./things/calculator/ - dockerfile: ./coap/js/Dockerfile-contentneg - args: - - PORT_ARG=${COAP_NEGOTIATION_PORT_OUT} + - traefik.udp.services.coap-calculator-simple.loadbalancer.server.port=${COAP_NEGOTIATION_PORT_OUT} environment: - - HOSTNAME=${HOSTNAME} + - HOSTNAME=${STACK_HOSTNAME} + - PORT=${COAP_NEGOTIATION_PORT_OUT} deploy: resources: limits: @@ -36,16 +33,16 @@ services: reservations: cpus: "0.01" memory: 25M + networks: + - things_network http-express-calculator-simple: + image: thingweb/test-things-http-express-calculator-simple labels: - traefik.http.routers.http-express-calculator-simple.rule=PathPrefix(`/http-express-calculator-simple`) - build: - context: ./things/calculator/ - dockerfile: ./http/express/Dockerfile-simple - args: - - PORT_ARG=${WEB_PORT_OUT} + - traefik.http.services.http-express-calculator-simple.loadbalancer.server.port=${WEB_PORT_OUT} environment: - - HOSTNAME=${HOSTNAME} + - HOSTNAME=${STACK_HOSTNAME} + - PORT=${WEB_PORT_OUT} - LOKI_HOSTNAME=${LOKI_HOSTNAME} - LOKI_PORT=${LOKI_PORT} deploy: @@ -56,24 +53,22 @@ services: reservations: cpus: "0.01" memory: 25M - depends_on: - - loki healthcheck: - test: wget --no-verbose --tries=1 --spider http://${HOSTNAME}:${WEB_PORT_OUT}/http-express-calculator-simple || exit 1 + test: wget --no-verbose --tries=1 --spider http://${STACK_HOSTNAME}:${WEB_PORT_OUT}/http-express-calculator-simple || exit 1 interval: ${HC_INTERVAL} timeout: ${HC_TIMEOUT} retries: ${HC_RETRIES} start_period: ${HC_START_PERIOD} + networks: + - things_network http-express-calculator-content-negotiation: + image: thingweb/test-things-http-express-calculator-content-negotiation labels: - traefik.http.routers.http-express-calculator-content-negotiation.rule=PathPrefix(`/http-express-calculator-content-negotiation`) - build: - context: ./things/calculator/ - dockerfile: ./http/express/Dockerfile-contentneg - args: - - PORT_ARG=${WEB_PORT_OUT} + - traefik.http.services.http-express-calculator-content-negotiation.loadbalancer.server.port=${WEB_PORT_OUT} environment: - - HOSTNAME=${HOSTNAME} + - HOSTNAME=${STACK_HOSTNAME} + - PORT=${WEB_PORT_OUT} deploy: resources: limits: @@ -83,21 +78,21 @@ services: cpus: "0.01" memory: 25M healthcheck: - test: wget --no-verbose --tries=1 --spider http://${HOSTNAME}:${WEB_PORT_OUT}/http-express-calculator-content-negotiation || exit 1 + test: wget --no-verbose --tries=1 --spider http://${STACK_HOSTNAME}:${WEB_PORT_OUT}/http-express-calculator-content-negotiation || exit 1 interval: ${HC_INTERVAL} timeout: ${HC_TIMEOUT} retries: ${HC_RETRIES} start_period: ${HC_START_PERIOD} + networks: + - things_network http-flask-calculator: + image: thingweb/test-things-flask-calculator labels: - traefik.http.routers.http-flask-calculator.rule=PathPrefix(`/http-flask-calculator`) - build: - context: ./things/calculator/ - dockerfile: ./http/flask/Dockerfile - args: - - PORT_ARG=${WEB_PORT_OUT} + - traefik.http.services.http-flask-calculator.loadbalancer.server.port=${WEB_PORT_OUT} environment: - - HOSTNAME=${HOSTNAME} + - HOSTNAME=${STACK_HOSTNAME} + - PORT=${WEB_PORT_OUT} deploy: resources: limits: @@ -107,16 +102,17 @@ services: cpus: "0.01" memory: 25M healthcheck: - test: wget --no-verbose --tries=1 --spider http://${HOSTNAME}:${WEB_PORT_OUT}/http-flask-calculator || exit 1 + test: wget --no-verbose --tries=1 --spider http://${STACK_HOSTNAME}:${WEB_PORT_OUT}/http-flask-calculator || exit 1 interval: ${HC_INTERVAL} timeout: ${HC_TIMEOUT} retries: ${HC_RETRIES} start_period: ${HC_START_PERIOD} + networks: + - things_network mqtt-calculator: - build: - context: ./things/calculator/ - dockerfile: ./mqtt/js/Dockerfile + image: thingweb/test-things-mqtt-calculator environment: + - BROKER_URI=${BROKER_URI} - LOKI_HOSTNAME=${LOKI_HOSTNAME} - LOKI_PORT=${LOKI_PORT} deploy: @@ -127,17 +123,14 @@ services: reservations: cpus: "0.01" memory: 25M + networks: + - things_network modbus-elevator: + image: thingweb/test-things-modbus-elevator labels: - traefik.tcp.routers.modbus-elevator.entrypoints=modbus-elevator - traefik.tcp.routers.modbus-elevator.rule=HostSNI(`*`) - environment: - - BROKER_URI=${BROKER_URI} - build: - context: ./things/elevator/ - dockerfile: ./modbus/js/Dockerfile - args: - - PORT_ARG=${MODBUS_ELEVATOR_PORT_OUT} + - traefik.tcp.services.modbus-elevator.loadbalancer.server.port=${MODBUS_ELEVATOR_PORT_OUT} deploy: resources: limits: @@ -146,16 +139,16 @@ services: reservations: cpus: "0.01" memory: 25M + networks: + - things_network http-advanced-coffee-machine: + image: thingweb/test-things-http-advanced-coffee-machine labels: - traefik.http.routers.http-advanced-coffee-machine.rule=PathPrefix(`/http-advanced-coffee-machine`) - build: - context: ./things/advanced-coffee-machine - dockerfile: ./http/ts/Dockerfile - args: - - PORT_ARG=${WEB_PORT_OUT} + - traefik.http.services.http-advanced-coffee-machine.loadbalancer.server.port=${WEB_PORT_OUT} environment: - - HOSTNAME=${HOSTNAME} + - HOSTNAME=${STACK_HOSTNAME} + - PORT=${WEB_PORT_OUT} deploy: resources: limits: @@ -164,16 +157,16 @@ services: reservations: cpus: "0.01" memory: 25M + networks: + - things_network http-data-schema-thing: + image: thingweb/test-things-http-data-schema-thing labels: - traefik.http.routers.http-data-schema-thing.rule=PathPrefix(`/http-data-schema-thing`) - build: - context: ./things/data-schema-thing - dockerfile: ./http/ts/Dockerfile - args: - - PORT_ARG=${WEB_PORT_OUT} + - traefik.http.services.http-data-schema-thing.loadbalancer.server.port=${WEB_PORT_OUT} environment: - - HOSTNAME=${HOSTNAME} + - HOSTNAME=${STACK_HOSTNAME} + - PORT=${WEB_PORT_OUT} - LOKI_HOSTNAME=${LOKI_HOSTNAME} - LOKI_PORT=${LOKI_PORT} deploy: @@ -184,10 +177,10 @@ services: reservations: cpus: "0.01" memory: 25M + networks: + - things_network smart-home-presence-sensor: - build: - context: ./mashups/smart-home - dockerfile: ./dockerfiles/presence-sensor.Dockerfile + image: thingweb/test-things-smart-home-presence-sensor deploy: resources: limits: @@ -196,20 +189,20 @@ services: reservations: cpus: "0.01" memory: 25M + networks: + - things_network smart-home-simple-coffee-machine: + image: thingweb/test-things-smart-home-simple-coffee-machine labels: # TD is not exposed since it contains hostname that cannot be accessed outside the docker network - traefik.http.routers.smart-home-simple-coffee-machine.rule=PathRegexp(`/smart-home-simple-coffee-machine/.+`) - build: - context: ./mashups/smart-home - dockerfile: ./dockerfiles/simple-coffee-machine.Dockerfile - args: - - PORT_ARG=${WEB_PORT_OUT} + - traefik.http.services.smart-home-simple-coffee-machine.loadbalancer.server.port=${WEB_PORT_OUT} environment: # Since mashup communicates inside the Docker network use of localhost in a TD result as # the mashup container's its own localhost. Therefore hostname given as their docker service name. # In production we will have a dedicated address and this issue won't be a problem. - SIMPLE_COFFEE_MACHINE_HOSTNAME=smart-home-simple-coffee-machine + - PORT=${WEB_PORT_OUT} deploy: resources: limits: @@ -218,19 +211,19 @@ services: reservations: cpus: "0.01" memory: 25M + networks: + - things_network smart-home-smart-clock: + image: thingweb/test-things-smart-home-smart-clock labels: - traefik.udp.routers.smart-home-smart-clock.entrypoints=smart-home-smart-clock - build: - context: ./mashups/smart-home - dockerfile: ./dockerfiles/smart-clock.Dockerfile - args: - - PORT_ARG=${SMART_HOME_SMART_CLOCK_PORT_OUT} + - traefik.udp.services.smart-home-smart-clock.loadbalancer.server.port=${SMART_HOME_SMART_CLOCK_PORT_OUT} environment: # Since mashup communicates inside the Docker network use of localhost in a TD result as # the mashup container's its own localhost. Therefore hostname given as their docker service name. # In production we will have a dedicated address and this issue won't be a problem. - SMART_CLOCK_HOSTNAME=smart-home-smart-clock + - PORT=${SMART_HOME_SMART_CLOCK_PORT_OUT} deploy: resources: limits: @@ -239,10 +232,10 @@ services: reservations: cpus: "0.01" memory: 50M + networks: + - things_network smart-home-mashup: - build: - context: ./mashups/smart-home - dockerfile: ./dockerfiles/mashup.Dockerfile + image: thingweb/test-things-smart-home-main environment: - SIMPLE_COFFEE_MACHINE_HOSTNAME=smart-home-simple-coffee-machine - PRESENCE_SENSOR_BROKER_URI=${BROKER_URI} @@ -261,3 +254,9 @@ services: reservations: cpus: "0.01" memory: 25M + networks: + - things_network +networks: + things_network: + name: things_network + external: true diff --git a/mashups/smart-home/dockerfiles/simple-coffee-machine.Dockerfile b/mashups/smart-home/dockerfiles/simple-coffee-machine.Dockerfile index cb8b4fd..5a8781b 100644 --- a/mashups/smart-home/dockerfiles/simple-coffee-machine.Dockerfile +++ b/mashups/smart-home/dockerfiles/simple-coffee-machine.Dockerfile @@ -10,10 +10,4 @@ COPY ./things/simple-coffee-machine.ts ./things/simple-coffee-machine.ts RUN npm run build -# To be able to expose the given port we use port argument, if exposing the port is not necessary we can simply remove them in the future. -ARG PORT_ARG=8081 -ENV SIMPLE_COFFEE_MACHINE_PORT=${PORT_ARG} - CMD ["npm", "run", "start:simple-coffee-machine"] - -EXPOSE ${SIMPLE_COFFEE_MACHINE_PORT} \ No newline at end of file diff --git a/mashups/smart-home/dockerfiles/smart-clock.Dockerfile b/mashups/smart-home/dockerfiles/smart-clock.Dockerfile index 728acbb..39aa018 100644 --- a/mashups/smart-home/dockerfiles/smart-clock.Dockerfile +++ b/mashups/smart-home/dockerfiles/smart-clock.Dockerfile @@ -10,10 +10,4 @@ COPY ./things/smart-clock.ts ./things/smart-clock.ts RUN npm run build -# To be able to expose the given port we use port argument, if exposing the port is not necessary we can simply remove them in the future. -ARG PORT_ARG=8081 -ENV SMART_CLOCK_PORT=${PORT_ARG} - CMD ["npm", "run", "start:smart-clock"] - -EXPOSE ${SMART_CLOCK_PORT}/udp \ No newline at end of file diff --git a/things/advanced-coffee-machine/http/ts/Dockerfile b/things/advanced-coffee-machine/http/ts/Dockerfile index 896811b..56decfb 100644 --- a/things/advanced-coffee-machine/http/ts/Dockerfile +++ b/things/advanced-coffee-machine/http/ts/Dockerfile @@ -8,11 +8,6 @@ RUN npm install RUN npm run build -# To be able to expose the given port we use port argument, if exposing the port is not necessary we can simply remove them in the future. -ARG PORT_ARG=3000 -ENV PORT=${PORT_ARG} ENV TM_PATH="../advanced-coffee-machine.tm.json" CMD ["node", "./dist/main.js"] - -EXPOSE ${PORT} \ No newline at end of file diff --git a/things/calculator/coap/js/Dockerfile-contentneg b/things/calculator/coap/js/Dockerfile-contentneg index d5d867c..33f8a24 100644 --- a/things/calculator/coap/js/Dockerfile-contentneg +++ b/things/calculator/coap/js/Dockerfile-contentneg @@ -6,11 +6,6 @@ COPY ./coap/js . RUN npm install -# To be able to expose the given port we use port argument, if exposing the port is not necessary we can simply remove them in the future. -ARG PORT_ARG=5684 -ENV PORT=${PORT_ARG} ENV TM_PATH="./calculator.tm.json" CMD ["node", "coap-content-negotiation-calculator.js"] - -EXPOSE ${PORT}/udp \ No newline at end of file diff --git a/things/calculator/coap/js/Dockerfile-simple b/things/calculator/coap/js/Dockerfile-simple index 9bed510..6f9bb69 100644 --- a/things/calculator/coap/js/Dockerfile-simple +++ b/things/calculator/coap/js/Dockerfile-simple @@ -6,11 +6,6 @@ COPY ./coap/js . RUN npm install -# To be able to expose the given port we use port argument, if exposing the port is not necessary we can simply remove them in the future. -ARG PORT_ARG=5683 -ENV PORT=${PORT_ARG} ENV TM_PATH="./calculator.tm.json" CMD ["node", "coap-simple-calculator.js"] - -EXPOSE ${PORT}/udp \ No newline at end of file diff --git a/things/calculator/http/express/Dockerfile-contentneg b/things/calculator/http/express/Dockerfile-contentneg index f370dbf..0931992 100644 --- a/things/calculator/http/express/Dockerfile-contentneg +++ b/things/calculator/http/express/Dockerfile-contentneg @@ -6,11 +6,6 @@ COPY ./http/express . RUN npm install -# To be able to expose the given port we use port argument, if exposing the port is not necessary we can simply remove them in the future. -ARG PORT_ARG=3001 -ENV PORT=${PORT_ARG} ENV TM_PATH="./calculator.tm.json" CMD ["node", "http-content-negotiation-calculator.js"] - -EXPOSE ${PORT} \ No newline at end of file diff --git a/things/calculator/http/express/Dockerfile-simple b/things/calculator/http/express/Dockerfile-simple index d1696e2..e2e4f11 100644 --- a/things/calculator/http/express/Dockerfile-simple +++ b/things/calculator/http/express/Dockerfile-simple @@ -6,11 +6,6 @@ COPY ./http/express . RUN npm install -# To be able to expose the given port we use port argument, if exposing the port is not necessary we can simply remove them in the future. -ARG PORT_ARG=3000 -ENV PORT=${PORT_ARG} ENV TM_PATH="./calculator.tm.json" CMD ["node", "http-simple-calculator.js"] - -EXPOSE ${PORT} \ No newline at end of file diff --git a/things/calculator/http/flask/Dockerfile b/things/calculator/http/flask/Dockerfile index 1a8a7fd..513c857 100644 --- a/things/calculator/http/flask/Dockerfile +++ b/things/calculator/http/flask/Dockerfile @@ -7,13 +7,8 @@ WORKDIR /app COPY ./calculator.tm.json . COPY ./http/flask . -# To be able to expose the given port we use port argument, if exposing the port is not necessary we can simply remove them in the future. -ARG PORT_ARG=5000 -ENV PORT=${PORT_ARG} ENV TM_PATH=./calculator.tm.json RUN poetry install CMD [ "poetry", "run", "python", "main.py" ] - -EXPOSE ${PORT} \ No newline at end of file diff --git a/things/data-schema-thing/http/ts/Dockerfile b/things/data-schema-thing/http/ts/Dockerfile index 7715386..9ba0e44 100644 --- a/things/data-schema-thing/http/ts/Dockerfile +++ b/things/data-schema-thing/http/ts/Dockerfile @@ -8,11 +8,6 @@ RUN npm install RUN npm run build -# To be able to expose the given port we use port argument, if exposing the port is not necessary we can simply remove them in the future. -ARG PORT_ARG=3000 -ENV PORT=${PORT_ARG} ENV TM_PATH="../data-schema-thing.tm.json" CMD ["node", "./dist/main.js"] - -EXPOSE ${PORT} \ No newline at end of file diff --git a/things/elevator/modbus/js/Dockerfile b/things/elevator/modbus/js/Dockerfile index 055c5c4..3547d51 100644 --- a/things/elevator/modbus/js/Dockerfile +++ b/things/elevator/modbus/js/Dockerfile @@ -1,4 +1,4 @@ -FROM node:18-buster +FROM node:18-alpine WORKDIR /app COPY ./elevator.tm.json . @@ -6,11 +6,6 @@ COPY ./modbus/js . RUN npm install -# To be able to expose the given port we use port argument, if exposing the port is not necessary we can simply remove them in the future. -ARG PORT_ARG=8502 -ENV PORT=${PORT_ARG} ENV TM_PATH="./elevator.tm.json" CMD ["node", "main.js"] - -EXPOSE ${PORT}