Skip to content

Commit 3713c6f

Browse files
committed
Add a dockerfile to deploy
1 parent fb2ef6d commit 3713c6f

File tree

4 files changed

+59
-19
lines changed

4 files changed

+59
-19
lines changed

.dockerignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ python/build
77
*.egg-info
88
client/target
99
protocol/target
10-
target
10+
target
11+
.venv
12+
.pyprojectx

Makefile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
HELL := /bin/bash
2+
.ONESHELL:
3+
SHELLFLAGS := -eufo pipefail -c
4+
5+
curdir = $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
6+
projdir = $(curdir)
7+
version = $(shell ./ci/get-version.sh)
8+
9+
.PHONY: help
10+
help:
11+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
12+
13+
build-docker-container: ## Build the docker container
14+
echo "Building docker container with version: $(version)"
15+
cd $(projdir)
16+
docker build -f deploy/Dockerfile -t comsrv:$(version) .

README.md

+25-18
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
The `comsrv` utility exposes an [RPC interface](https://github.com/raffber/wsrpc) mainly intended for communicating with lab instruments.
66
Currently, the following type of instruments are supported:
77

8-
* Serial Ports
9-
* VXI-11/LXI Instruments
10-
* Prologix USB-to-GPIB adapters
11-
* Modbus/TCP instruments
12-
* Modbus/RTU over serial ports or TCP streams
13-
* Raw TCP Sockets
14-
* USB HID based devices
15-
* FTDI devices
16-
* CAN over PCAN and SocketCAN (linux-only)
17-
* All VISA controlled instruments as fallback (requires VISA installation)
8+
- Serial Ports
9+
- VXI-11/LXI Instruments
10+
- Prologix USB-to-GPIB adapters
11+
- Modbus/TCP instruments
12+
- Modbus/RTU over serial ports or TCP streams
13+
- Raw TCP Sockets
14+
- USB HID based devices
15+
- FTDI devices
16+
- CAN over PCAN and SocketCAN (linux-only)
17+
- All VISA controlled instruments as fallback (requires VISA installation)
1818

1919
`comsrv` automatically manages connections and operating system handles:
2020

21-
* If no connection has been established, the connection is automatically opened
22-
* If the connection drops and a new request is issued, the connection is automatically reopened
23-
* In case the configuration of a instrument changes (such as the baud-rate on a serial port), it is appropriately re-initialized
21+
- If no connection has been established, the connection is automatically opened
22+
- If the connection drops and a new request is issued, the connection is automatically reopened
23+
- In case the configuration of a instrument changes (such as the baud-rate on a serial port), it is appropriately re-initialized
2424

2525
Thus, the application using the `comsrv` should not care much about how connections are managed. It must also not care about spawning threadpools for IO, bridging async and sync interface or worry about library support for exotic protcols. As a consequence most of the connectivity error handling is offloaded
2626
to the `comsrv`.
@@ -41,16 +41,23 @@ The log will print executed commands as well as inform about communication error
4141

4242
## Documentation
4343

44-
* The RPC protocol is: https://github.com/raffber/wsrpc. `comsrv` specific information [here](doc/rpc-protocol.md).
45-
* The Python API is described [here](doc/python_api.md).
46-
* Optional VISA-compatible resource strings for short-hand initialization of instrument are documented [here](doc/python_resource_strings.md).
44+
- The RPC protocol is: https://github.com/raffber/wsrpc. `comsrv` specific information [here](doc/rpc-protocol.md).
45+
- The Python API is described [here](doc/python_api.md).
46+
- Optional VISA-compatible resource strings for short-hand initialization of instrument are documented [here](doc/python_resource_strings.md).
47+
48+
## Building
49+
50+
Apart from the rust toolchain you also need the following debian/ubuntu packages:
51+
52+
- `libuv-dev`
53+
- `libclang-dev`
4754

4855
## License
4956

5057
Licensed under either of
5158

52-
* Apache License, Version 2.0, (LICENSE-APACHE or <http://www.apache.org/licenses/LICENSE-2.0>)
53-
* MIT license (LICENSE-MIT or <http://opensource.org/licenses/MIT>)
59+
- Apache License, Version 2.0, (LICENSE-APACHE or <http://www.apache.org/licenses/LICENSE-2.0>)
60+
- MIT license (LICENSE-MIT or <http://opensource.org/licenses/MIT>)
5461

5562
at your option.
5663

deploy/Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM rust:1.80 as builder
2+
3+
4+
RUN apt-get update && apt-get install -y \
5+
libudev-dev libclang-dev \
6+
&& rm -rf /var/lib/apt
7+
8+
WORKDIR /workspace
9+
ADD --chown=0:0 . /workspace/
10+
11+
RUN cargo build --release
12+
13+
FROM debian:bookworm-slim
14+
15+
COPY --from=builder /workspace/target/release/comsrv /usr/bin/comsrv

0 commit comments

Comments
 (0)