Skip to content

Commit

Permalink
Upgrade dependencies (#22)
Browse files Browse the repository at this point in the history
* Upgrade dependencies

* fixing python path

* adding --break-system-packages when installing python mdules with pip
  • Loading branch information
cybcon authored Dec 23, 2024
1 parent 5891612 commit ff76ed8
Show file tree
Hide file tree
Showing 12 changed files with 280 additions and 154 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build-and-push-container-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
!contains(github.event.pull_request.labels.*.name, 'chore')
steps:
- name: Checkout GIT repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Get the application version
id: application-version
run: |
Expand All @@ -30,16 +30,16 @@ jobs:
fi
echo "tag=${image_version}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to container registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v6
with:
push: true
context: .
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/container-image-build-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout GIT repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Test build
uses: docker/build-push-action@v4.1.0
uses: docker/build-push-action@v6
with:
push: false
load: false
context: .
platforms: linux/amd64, linux/arm64
tags: container-build:test
- name: Test build and export for further validation
uses: docker/build-push-action@v4.1.0
uses: docker/build-push-action@v6
with:
push: false
load: true
context: .
tags: container-build:test
outputs: type=docker,dest=/tmp/container.tar
- name: Upload container image as artifact
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v4
with:
name: container-build
path: /tmp/container.tar
Expand All @@ -49,7 +49,7 @@ jobs:
- name: Log in to Github container registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build container for functionality test
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: true
load: false
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
scan:
name: Container vulnerability scan
needs: container-build
uses: cybcon/github_workflows/.github/workflows/container-vulnerability-scan.yaml@v1.1.10
uses: cybcon/github_workflows/.github/workflows/container-vulnerability-scan.yaml@v1.4.0
with:
image_name: container-build:test
image_artifact_filename: container.tar
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ on:
- main
jobs:
pre-commit:
uses: cybcon/github_workflows/.github/workflows/pre-commit.yaml@v1.1.10
uses: cybcon/github_workflows/.github/workflows/pre-commit.yaml@v1.4.0
2 changes: 1 addition & 1 deletion .github/workflows/release-from-label.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ on:
- closed
jobs:
release:
uses: cybcon/github_workflows/.github/workflows/release-from-label.yaml@v1.1.10
uses: cybcon/github_workflows/.github/workflows/release-from-label.yaml@v1.4.0
2 changes: 1 addition & 1 deletion .github/workflows/release-label-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ on:
- unlabeled
jobs:
release-label-validation:
uses: cybcon/github_workflows/.github/workflows/release-label-validation.yaml@v1.1.10
uses: cybcon/github_workflows/.github/workflows/release-label-validation.yaml@v1.4.0
47 changes: 41 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,50 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-ast
- id: debug-statements
- id: fix-byte-order-marker
- id: check-json
- id: check-yaml
- id: end-of-file-fixer
- id: fix-encoding-pragma
- id: mixed-line-ending
- id: requirements-txt-fixer
- id: trailing-whitespace
- id: mixed-line-ending
args: ['--fix=lf']
description: Forces to replace line ending by the UNIX 'lf' character
- id: detect-aws-credentials
args: ['--allow-missing-credentials']
- id: detect-private-key
- repo: https://github.com/myint/autoflake
rev: v2.3.1
hooks:
- id: autoflake
args:
- --in-place
- --remove-unused-variables
- --remove-all-unused-imports
- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
hooks:
- id: hadolint-docker
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.8.4
hooks:
- id: ruff
args:
- '--line-length=120'
- '--fix'
- '--exit-non-zero-on-fix'
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
args:
- '--profile'
- black
- '--filter-files'
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
args:
- '--line-length=120'
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pre-commit 2.20.0
pre-commit 4.0.1
24 changes: 12 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
FROM alpine:3.18.8 AS base
FROM alpine:3.21.0 AS base
RUN apk upgrade --available --no-cache --update \
&& apk add --no-cache --update \
python3=3.11.8-r1 \
py3-pip=23.1.2-r0 \
python3=3.12.8-r1 \
py3-pip=24.3.1-r0 \
# Cleanup APK
&& rm -rf /var/cache/apk/* /tmp/* /var/tmp/*



# Compiling python modules
FROM base as builder
FROM base AS builder
RUN apk add --no-cache --update \
g++=12.2.1_git20220924-r10 \
python3-dev=3.11.8-r1 \
g++=14.2.0-r4 \
python3-dev=3.12.8-r1 \
&& ln -s /usr/include/locale.h /usr/include/xlocale.h
COPY --chown=root:root FloatToHex /FloatToHex

Expand All @@ -26,18 +26,18 @@ RUN python3 setup.py install
# Building the docker image with already compiled modules
FROM base
LABEL maintainer="Michael Oberdorf IT-Consulting <[email protected]>"
LABEL site.local.program.version="1.0.15"
LABEL site.local.program.version="1.0.16"

COPY --from=builder /usr/lib/python3.11/site-packages /usr/lib/python3.11/site-packages
COPY --from=builder /usr/lib/python3.12/site-packages /usr/lib/python3.12/site-packages

RUN apk add --no-cache --update \
libstdc++=12.2.1_git20220924-r10 \
py3-wheel=0.40.0-r1 \
py3-pandas=1.5.3-r1
libstdc++=14.2.0-r4 \
py3-wheel=0.43.0-r0 \
py3-pandas=2.2.3-r0

COPY --chown=root:root /src /

RUN pip3 install --no-cache-dir -r /requirements.txt
RUN pip3 install --no-cache-dir -r /requirements.txt --break-system-packages

USER 3748:3748

Expand Down
46 changes: 23 additions & 23 deletions FloatToHex/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@
# setup.py install to install the package - needs C compiler (vcvarsall.bat on windows)


from distutils.core import setup, Extension
from distutils.core import Extension, setup

FloatToHexModule = Extension('FloatToHex',
sources = ['floattohexmodule.c'])
FloatToHexModule = Extension("FloatToHex", sources=["floattohexmodule.c"])

setup (name = 'FloatToHex',
version = '1.0',
url = 'https://gregstoll.com/~gregstoll/floattohex/',
author = 'Gregory Stoll',
author_email = '[email protected]',
description = 'Converts float to hex and back',
long_description=open('README.md').read(),
#long_description_content_type='text/markdown',
license='Python Software Foundation License',
classifiers=[
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: Python Software Foundation License',
'Operating System :: POSIX',
'Programming Language :: Python',
'Topic :: Communications :: Modbus',
],
ext_modules = [FloatToHexModule]
)
setup(
name="FloatToHex",
version="1.0",
url="https://gregstoll.com/~gregstoll/floattohex/",
author="Gregory Stoll",
author_email="[email protected]",
description="Converts float to hex and back",
long_description=open("README.md").read(),
# long_description_content_type='text/markdown',
license="Python Software Foundation License",
classifiers=[
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: Python Software Foundation License",
"Operating System :: POSIX",
"Programming Language :: Python",
"Topic :: Communications :: Modbus",
],
ext_modules=[FloatToHexModule],
)
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2023 Michael Oberdorf IT-Consulting
Copyright (c) 2020-2024 Michael Oberdorf IT-Consulting

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
48 changes: 46 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,26 @@ Source code: [GitHub](https://github.com/cybcon/modbus-client)

Container Registry: [DockerHub](https://hub.docker.com/r/oitc/modbus-client)

<!-- SHIELD GROUP -->
[![][github-action-test-shield]][github-action-test-link]
[![][github-action-release-shield]][github-action-release-link]
[![][github-release-shield]][github-release-link]
[![][github-releasedate-shield]][github-releasedate-link]
[![][github-stars-shield]][github-stars-link]
[![][github-forks-shield]][github-forks-link]
[![][github-issues-shield]][github-issues-link]
[![][github-license-shield]][github-license-link]

[![][docker-release-shield]][docker-release-link]
[![][docker-pulls-shield]][docker-pulls-link]
[![][docker-stars-shield]][docker-stars-link]
[![][docker-size-shield]][docker-size-link]


# Supported tags and respective `Dockerfile` links

* [`latest`, `1.0.15`](https://github.com/cybcon/modbus-client/blob/v1.0.15/Dockerfile)
* [`latest`, `1.0.16`](https://github.com/cybcon/modbus-client/blob/v1.0.16/Dockerfile)
* [`1.0.15`](https://github.com/cybcon/modbus-client/blob/v1.0.15/Dockerfile)
* [`1.0.14`](https://github.com/cybcon/modbus-client/blob/v1.0.14/Dockerfile)
* [`1.0.13`](https://github.com/cybcon/modbus-client/blob/v1.0.13/Dockerfile)
* [`1.0.12`](https://github.com/cybcon/modbus-client/blob/v1.0.12/Dockerfile)
Expand Down Expand Up @@ -103,7 +120,7 @@ I would appreciate a small donation to support the further development of my ope

# License

Copyright (c) 2020-2023 Michael Oberdorf IT-Consulting
Copyright (c) 2020-2024 Michael Oberdorf IT-Consulting

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -122,3 +139,30 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

<!-- LINK GROUP -->
[docker-pulls-link]: https://hub.docker.com/r/oitc/modbus-client
[docker-pulls-shield]: https://img.shields.io/docker/pulls/oitc/modbus-client?color=45cc11&labelColor=black&style=flat-square
[docker-release-link]: https://hub.docker.com/r/oitc/modbus-client
[docker-release-shield]: https://img.shields.io/docker/v/oitc/modbus-client?color=369eff&label=docker&labelColor=black&logo=docker&logoColor=white&style=flat-square
[docker-size-link]: https://hub.docker.com/r/oitc/modbus-client
[docker-size-shield]: https://img.shields.io/docker/image-size/oitc/modbus-client?color=369eff&labelColor=black&style=flat-square
[docker-stars-link]: https://hub.docker.com/r/oitc/modbus-client
[docker-stars-shield]: https://img.shields.io/docker/stars/oitc/modbus-client?color=45cc11&labelColor=black&style=flat-square
[github-action-release-link]: https://github.com/cybcon/modbus-client/actions/workflows/release-from-label.yaml
[github-action-release-shield]: https://img.shields.io/github/actions/workflow/status/cybcon/modbus-client/release-from-label.yaml?label=release&labelColor=black&logo=githubactions&logoColor=white&style=flat-square
[github-action-test-link]: https://github.com/cybcon/modbus-client/actions/workflows/container-image-build-validation.yaml
[github-action-test-shield-original]: https://github.com/cybcon/modbus-client/actions/workflows/container-image-build-validation.yaml/badge.svg
[github-action-test-shield]: https://img.shields.io/github/actions/workflow/status/cybcon/modbus-client/container-image-build-validation.yaml?label=tests&labelColor=black&logo=githubactions&logoColor=white&style=flat-square
[github-forks-link]: https://github.com/cybcon/modbus-client/network/members
[github-forks-shield]: https://img.shields.io/github/forks/cybcon/modbus-client?color=8ae8ff&labelColor=black&style=flat-square
[github-issues-link]: https://github.com/cybcon/modbus-client/issues
[github-issues-shield]: https://img.shields.io/github/issues/cybcon/modbus-client?color=ff80eb&labelColor=black&style=flat-square
[github-license-link]: https://github.com/cybcon/modbus-client/blob/main/LICENSE
[github-license-shield]: https://img.shields.io/badge/license-MIT-blue?labelColor=black&style=flat-square
[github-release-link]: https://github.com/cybcon/modbus-client/releases
[github-release-shield]: https://img.shields.io/github/v/release/cybcon/modbus-client?color=369eff&labelColor=black&logo=github&style=flat-square
[github-releasedate-link]: https://github.com/cybcon/modbus-client/releases
[github-releasedate-shield]: https://img.shields.io/github/release-date/cybcon/modbus-client?labelColor=black&style=flat-square
[github-stars-link]: https://github.com/cybcon/modbus-client
[github-stars-shield]: https://img.shields.io/github/stars/cybcon/modbus-client?color=ffcb47&labelColor=black&style=flat-square
Loading

0 comments on commit ff76ed8

Please sign in to comment.