Skip to content

Commit bfd58da

Browse files
authored
Initial Docker support (#34)
* Initial Docker support * Dockerfile cleanup * Readme cleanup
1 parent 5d4fa7f commit bfd58da

File tree

4 files changed

+92
-0
lines changed

4 files changed

+92
-0
lines changed

.dockerignore

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Include any files or directories that you don't want to be copied to your
2+
# container here (e.g., local build artifacts, temporary files, etc.).
3+
#
4+
# For more help, visit the .dockerignore file reference guide at
5+
# https://docs.docker.com/go/build-context-dockerignore/
6+
7+
**/.DS_Store
8+
**/__pycache__
9+
**/.venv
10+
**/.classpath
11+
**/.dockerignore
12+
**/.env
13+
**/.git
14+
**/.gitignore
15+
**/.project
16+
**/.settings
17+
**/.toolstarget
18+
**/.vs
19+
**/.vscode
20+
**/*.*proj.user
21+
**/*.dbmdl
22+
**/*.jfm
23+
**/bin
24+
**/charts
25+
**/docker-compose*
26+
**/compose.y*ml
27+
**/Dockerfile*
28+
**/node_modules
29+
**/npm-debug.log
30+
**/obj
31+
**/secrets.dev.yaml
32+
**/values.dev.yaml
33+
LICENSE
34+
README.md

Dockerfile

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# syntax=docker/dockerfile:1
2+
3+
ARG PYTHON_VERSION=3.12.3
4+
FROM python:${PYTHON_VERSION}-slim as base
5+
6+
# Prevents Python from writing pyc files.
7+
ENV PYTHONDONTWRITEBYTECODE=1
8+
9+
# Keeps Python from buffering stdout and stderr to avoid situations where
10+
# the application crashes without emitting any logs due to buffering.
11+
ENV PYTHONUNBUFFERED=1
12+
13+
# Choose poetry version
14+
ENV POETRY_VERSION=1.8.2
15+
16+
# Download dependencies as a separate step to take advantage of Docker's caching.
17+
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
18+
# Leverage a bind mount to requirements.txt to avoid having to copy them into
19+
# into this layer.
20+
RUN --mount=type=cache,target=/root/.cache/pip \
21+
python3 -m pip install "poetry==$POETRY_VERSION"
22+
23+
# Install all dependencies for aiocomfoconnect
24+
COPY pyproject.toml poetry.lock .
25+
RUN poetry export -f requirements.txt | python3 -m pip install -r /dev/stdin
26+
27+
# Copy the source code into the container.
28+
COPY . .
29+
30+
FROM base as final
31+
32+
# Run the application.
33+
ENTRYPOINT ["python3", "-m", "aiocomfoconnect"]

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@ codefix:
1313
test:
1414
@poetry run pytest
1515

16+
build:
17+
docker build -t aiocomfoconnect .
18+
1619
.PHONY: check codefix test

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,28 @@ $ python -m aiocomfoconnect get-property --host 192.168.1.213 1 1 8 9 # Unit 0x
7979
- `async cmd_rpdo_request(pdid, type, zone, timeout)`: Send a RPDO request.
8080
- `async cmd_keepalive()`: Send a keepalive message.
8181

82+
## Docker
83+
84+
### Description
85+
Docker with aiocomfoconnect allow to experiment and develop on local machine using same image and same environment on any platform where we can run container.
86+
This allow us to skip some platform issues and work on similar things and python version by easly swapping them in Dockerfile.
87+
88+
### Building
89+
90+
Build the image command
91+
```
92+
make build
93+
```
94+
95+
### Running
96+
Now after we build our images is called `aiocomfoconnect`
97+
98+
To run aiocomfoconnect we can use bellow command in this case with `--help` arg.
99+
```
100+
docker run aiocomfoconnect --help
101+
```
102+
Any args from `aiocomfoconnect` can be passed into this image run just like for `python3 -m aiocomfoconnect` command in local build.
103+
82104
## Examples
83105

84106
### Discovery of ComfoConnect LAN C Bridges

0 commit comments

Comments
 (0)