Update Dockerization authored by Daniel Kluge's avatar Daniel Kluge
...@@ -104,6 +104,14 @@ WORKDIR /root/app ...@@ -104,6 +104,14 @@ WORKDIR /root/app
``` ```
Again, this sets the current working directory inside the container. Again, this sets the current working directory inside the container.
```Dockerfile
RUN apt-get update && apt-get install -y mosquitto-clients libgpiod2 python3 python3-pip && rm -rf /var/lib/apt/lists/*
```
Here all necessary dependencies we may use later.
- `mosquitto-clients`: used for communication with out mqtt server
- `libgpiod2`: GPIO library
- `python3` & `python3-pip`: our sensors use Python scripts, so we need Python too. Pip because we want to install some packages.
```Dockerfile ```Dockerfile
COPY --from=build /root/.m2 /root/.m2 COPY --from=build /root/.m2 /root/.m2
COPY --from=build /root/app/target/classes classes COPY --from=build /root/app/target/classes classes
...@@ -112,9 +120,16 @@ COPY --from=build /root/app/classpath.txt . ...@@ -112,9 +120,16 @@ COPY --from=build /root/app/classpath.txt .
Here all files we need from the build stage are copied to our container. Here all files we need from the build stage are copied to our container.
```Dockerfile ```Dockerfile
COPY ./docker-scripts/requirements.txt requirements.txt
RUN python3 -m pip install -r requirements.txt && rm requirements.txt
```
Here the Python packages from the `requirements.txt` are installed.
```Dockerfile
COPY ./docker-scripts/sensors ./sensor-scripts
COPY start_component_docker.sh start_component.sh COPY start_component_docker.sh start_component.sh
``` ```
This copies the `start_component_docker.sh` file into the container, renaming it in the process. This copies our sensor scripts and the `start_component_docker.sh` file into the container, renaming the later it in the process.
```Dockerfile ```Dockerfile
ENTRYPOINT export CLASSPATH=/root/app/classes:$(cat /root/app/classpath.txt) && /root/app/start_component.sh ENTRYPOINT export CLASSPATH=/root/app/classes:$(cat /root/app/classpath.txt) && /root/app/start_component.sh
... ...
......