Skip to content

Commit

Permalink
Optimize container build (#7)
Browse files Browse the repository at this point in the history
* Increase Version

* Increase Version

* Add new Version

* Fixing linter issue

* Optimize container image build process

Co-authored-by: Michael Oberdorf <[email protected]>
  • Loading branch information
cybcon and Michael Oberdorf authored Jan 23, 2023
1 parent 0afa752 commit 71a16dc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ RUN apk add --no-cache \
&& ln -s /usr/include/locale.h /usr/include/xlocale.h
COPY FloatToHex /FloatToHex
WORKDIR /FloatToHex
RUN python3 setup.py install \
&& pip3 install --no-cache-dir \
pandas==1.5.3 \
'pymodbus>=2,<3'
RUN python3 setup.py install

# Building the docker image with already compiled modules
FROM base
Expand All @@ -25,12 +22,16 @@ LABEL site.local.os.version="3.17"
LABEL site.local.runtime.name="Python"
LABEL site.local.runtime.version="3.10.9"
LABEL site.local.program.name="Python Modbus TCP Client"
LABEL site.local.program.version="1.0.7"
LABEL site.local.program.version="1.0.9"

COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages

RUN apk add --no-cache \
libstdc++=12.2.1_git20220924-r4 \
py3-wheel=0.38.4-r0 \
py3-pandas=1.5.1-r0 \
&& pip3 install --no-cache-dir \
'pymodbus>=2,<3' \
&& addgroup -g 1000 -S pythonuser \
&& adduser -u 1000 -S pythonuser -G pythonuser \
&& mkdir -p /app
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Source code: [GitHub](https://github.com/cybcon/modbus-client)

# Supported tags and respective `Dockerfile` links

* [`latest`, `1.0.8`](https://github.com/cybcon/modbus-client/blob/v1.0.8/Dockerfile)
* [`latest`, `1.0.9`](https://github.com/cybcon/modbus-client/blob/v1.0.9/Dockerfile)
* [`1.0.8`](https://github.com/cybcon/modbus-client/blob/v1.0.8/Dockerfile)
* [`1.0.6`](https://github.com/cybcon/modbus-client/blob/1.0.6/Dockerfile)
* [`1.0.5`](https://github.com/cybcon/modbus-client/blob/1.0.5/Dockerfile)
* [`1.0.4`](https://github.com/cybcon/modbus-client/blob/1.0.4/dockerfile)
Expand Down
21 changes: 13 additions & 8 deletions app/modbus_client.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# -*- coding: utf-8 -*-
""" ***************************************************************************
Modbus TCP client script for debugging
Author: Michael Oberdorf IT-Consulting
Datum: 2020-05-20
Last modified by: Michael Oberdorf IT-Consulting
Last modified at: 2023-01-20
*************************************************************************** """
"""
###############################################################################
# Modbus TCP client script for debugging
# Author: Michael Oberdorf IT-Consulting
# Datum: 2020-05-20
# Last modified by: Michael Oberdorf IT-Consulting
# Last modified at: 2023-01-23
###############################################################################
"""
import sys
import os
if os.path.isdir('/usr/lib/python3.10/site-packages'):
sys.path.append('/usr/lib/python3.10/site-packages')

from pymodbus.client.sync import ModbusTcpClient as ModbusClient
import logging
import argparse
Expand All @@ -16,7 +21,7 @@
import FloatToHex
from numpy import little_endian

VERSION='1.0.8'
VERSION='1.0.9'
DEBUG=False
"""
###############################################################################
Expand Down

0 comments on commit 71a16dc

Please sign in to comment.