-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
662 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: docker | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
- | ||
name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
# list of Docker images to use as base name for tags | ||
images: | | ||
${{ github.repository }} | ||
ghcr.io/${{ github.repository }} | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Login to Docker Hub | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Login to Github Container Registry | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/386,linux/arm64,linux/arm | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## Docker | ||
|
||
A Docker image is available at https://hub.docker.com/r/pvtom/s10m | ||
|
||
### Configuration | ||
|
||
Create a `.config` file as described in the [Readme](README.md). | ||
|
||
### Start the docker container | ||
|
||
``` | ||
docker run --rm -v /path/to/your/.config:/app/.config pvtom/s10m:latest | ||
``` | ||
|
||
Thanks to [felix1507](https://github.com/felix1507/s10m-docker) for developing the Dockerfile! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM debian:latest as build-basis | ||
|
||
WORKDIR /build | ||
|
||
# Install dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y build-essential git automake autoconf libtool libmosquitto-dev | ||
|
||
FROM build-basis as build-libmodbus | ||
|
||
WORKDIR /libmodbus | ||
|
||
RUN git clone https://github.com/stephane/libmodbus.git . && \ | ||
bash autogen.sh && \ | ||
./configure && \ | ||
make install | ||
|
||
FROM build-libmodbus as build-s10m | ||
|
||
WORKDIR /build_s10m | ||
COPY . . | ||
|
||
RUN make | ||
|
||
FROM debian:latest as runtime | ||
|
||
WORKDIR /app | ||
COPY --from=build-s10m /build_s10m/s10m /usr/bin | ||
COPY --from=build-libmodbus /usr/local/lib/* /usr/local/lib/ | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y libmosquitto-dev | ||
|
||
CMD [ "s10m" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ $(PRG): clean | |
$(CC) -O3 s10m.c $(MODBUS_CFLAGS) -lmosquitto $(MODBUS_LIBS) -o $@ | ||
|
||
clean: | ||
-rm $(PRG) | ||
-rm -f $(PRG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
MODBUS_HOST=e3dc | ||
MODBUS_PORT=502 | ||
MQTT_HOST=mqttbroker | ||
MQTT_PORT=1883 | ||
MQTT_AUTH=false | ||
MQTT_USER= | ||
MQTT_PASSWORD= | ||
MQTT_RETAIN=false | ||
MQTT_QOS=0 | ||
INTERVAL=1 | ||
ROOT_TOPIC=s10 | ||
FORCE=false |
Oops, something went wrong.