Using Docker Compose and Docker Build
Now, let’s do the same exercise again but use Docker Build and Docker Compose. It is important to also do this exercise to speed up deployment in the following chapters:
- From the command console, run the following command:
$ cd Hands-On-Industrial-Internet-of-Things-Second-Edition/ Chapter7
- Then, build the two Dockerfile provided with the following:
$ docker compose build
- Then, we can start the three servers using the following:
$ docker compose up
The Dockerfile to build the OPC UA server is the following:
FROM node:alpine RUN apk add --update openssl RUN mkdir /app WORKDIR /app COPY package.json /app RUN npm install COPY . /app EXPOSE 26543 CMD ["npm", "start"]
The first line inherits the current image from the official image of Node.js (https://hub.docker.com/_/node/); if the image is not available on the local PC, Docker will download it from Docker Hub.
In the second line, we install openssl...