Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/docker-hub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish Docker image

on:
release:
types: [published]

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

-
name: Set up QEMU
uses: docker/setup-qemu-action@v2

-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ github.repository }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
50 changes: 50 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Create and publish a Docker image

on:
release:
types: [published]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# syntax=docker/dockerfile:1

FROM python:3.8-slim-buster

WORKDIR /pymodbus

COPY . .

RUN pip3 install -r requirements.txt && pip3 install -e .

19 changes: 19 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ Or to install a specific release:

pip install -U pymodbus==X.Y.Z

You can also use Docker to run a local image with the package installed on the image:

docker pull riptideio/pymodbus

Otherwise you can pull the trunk source and install from there::

git clone git://github.com/riptideio/pymodbus.git
Expand Down Expand Up @@ -236,6 +240,21 @@ This installs pymodbus in your virtual environment with pointers directly to the
Either method will install all the required dependencies
(at their appropriate versions) for your current python distribution.

------------------------------------------------------------
Docker Compose
------------------------------------------------------------

If you would like to use this image as part of a `docker compose` project, you can provide a custom command. For example,
you can spin the server by creating a docker compose file containing the following::

pymodbus-server:
container_name: pymodbus-server
image: riptideio/pymodbus:X.Y.Z
command: ["./examples/server_sync.py"]

After running `docker compose up`, you should have running the `server_sync.py` example, ready to accept connections from a client. You can,
of course, add a custom script instead, to run your own logic instead.

------------------------------------------------------------
Repository structure
------------------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions pymodbus/repl/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ Install pymodbus with repl support
$ pip install pymodbus[repl] --upgrade
```

## Docker
Pull Docker image with everything installed

`docker pull riptideio/pymodbus`


## Usage Instructions
RTU and TCP are supported as of now

Expand All @@ -32,7 +38,9 @@ Commands:
serial
tcp

# Or using a Docker run command instead

✗ docker run -it riptideio/pymodbus pymodbus.console --help
```
TCP Options

Expand Down
11 changes: 11 additions & 0 deletions pymodbus/repl/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ Install `pymodbus` with the required dependencies

`pip install pymodbus[repl]`

## Docker
Pull Docker image with everything installed

`docker pull riptideio/pymodbus`

## Usage

Invoke REPL server with `pymodbus.server run` command.
Expand Down Expand Up @@ -46,6 +51,12 @@ Invoke REPL server with `pymodbus.server run` command.
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
```

If using the docker image, you can run all the same commands, prepending the `docker run` command. For example:

```shell
docker run -it riptideio/pymodbus pymodbus.server --help
```

```shell
✗ pymodbus.server run --help

Expand Down