Changes
Page history
Update Dockerization
authored
Sep 14, 2022
by
Daniel Kluge
Show whitespace changes
Inline
Side-by-side
follow-up/Dockerization.md
View page @
6eb3f201
...
...
@@ -104,6 +104,14 @@ WORKDIR /root/app
```
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
COPY
--from=build /root/.m2 /root/.m2
COPY
--from=build /root/app/target/classes classes
...
...
@@ -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.
```
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
```
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
ENTRYPOINT
export CLASSPATH=/root/app/classes:$(cat /root/app/classpath.txt) && /root/app/start_component.sh
...
...
...
...