OIBus with Docker
OIBus can be incorporated into a Docker image.
Docker image
The image below takes two optional parameters:
- arch (default: x64)
- version
This facilitates the generation of a Docker image featuring a specific version and architecture of OIBus.
To construct a Docker image, two files are required:
- The initialization script, used for executing certain curl commands from within the container (or none if the file is empty).
- The Dockerfile, used for building the image containing the OIBus binaries.
Init script
This image necessitates an oibus-init.sh
script to dispatch curl commands to OIBus endpoints. If you opt not to
incorporate this file, you'll have to execute a curl command from within the Docker manually.
oibus-init.sh
#!/bin/bash
curl --location --request POST 'http://localhost:2223/api/ip-filters' \
--header 'Content-Type: application/json' \
--data-raw '{
"address": "*",
"description": "All"
}' \
-u "admin:pass"
Dockerfile
FROM ubuntu
ARG arch="x64"
ARG version="v3.5.4"
# Install git
RUN apt update -y && apt install -y curl unzip
# Create app directory
WORKDIR /app
RUN curl -LO https://github.com/OptimistikSAS/OIBus/releases/download/${version}/oibus-linux_${arch}-${version}.zip
RUN unzip -a oibus-linux_${arch}-${version}.zip -d OIBus/
WORKDIR /app/OIBus
COPY ./oibus-init.sh .
RUN mkdir OIBusData
# Expose port 2223 for OIBus
EXPOSE 2223
# Start OIBus
CMD ["./oibus-launcher", "--config", "./OIBusData"]
Docker commands
To execute the following commands, ensure that you are in the directory that contains the Dockerfile image.
Build the docker image
docker build -t oibus .
Build the docker image with specific architecture and version
docker build -t oibus --build-arg arch="arm64" --build-arg version="v3.3.2" .