From 9f08cb49b75da67baec1b08846f98570b7b9aa1e Mon Sep 17 00:00:00 2001 From: Ben Hall Date: Thu, 28 Dec 2023 13:34:15 -0500 Subject: [PATCH] changing dockerfile and script --- .github/workflows/create_releases.yml | 30 --------------------------- example/test_dbc_pio/platformio.ini | 2 +- generator/pio_lib_gen.py | 19 ++++++++++++----- third-party/Dockerfile | 1 + 4 files changed, 16 insertions(+), 36 deletions(-) diff --git a/.github/workflows/create_releases.yml b/.github/workflows/create_releases.yml index 18de67e..dd92a40 100644 --- a/.github/workflows/create_releases.yml +++ b/.github/workflows/create_releases.yml @@ -9,36 +9,6 @@ env: IMAGE_NAME: ${{ github.actor }}/ccoderdbc jobs: - # build-release-win: - # runs-on: windows-latest # Choose the appropriate OS for your project - - # steps: - # - uses: actions/checkout@v2 # Check out your repository - - # - name: Configure Project - # uses: threeal/cmake-action@v1.3.0 - # with: - # source-dir: third-party - # - name: Build and Package for windows - # run: | - # cd third-party - # cd build - # cmake .. - # cmake --build . --target package # Generate installer - # cp Project-0.1.0-win64.exe ../Project-0.1.0-win64.exe # Replace with your actual installer name - # cd .. - - # - name: Get current date and time - # id: date - # run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H_%M_%S')" - - # - name: Release - # uses: softprops/action-gh-release@v1 - # with: - # tag_name: ${{ steps.date.outputs.date }} - # files: Project-0.1.0-win64.exe - - build-and-push-image: runs-on: ubuntu-latest diff --git a/example/test_dbc_pio/platformio.ini b/example/test_dbc_pio/platformio.ini index 114c1f8..a831143 100644 --- a/example/test_dbc_pio/platformio.ini +++ b/example/test_dbc_pio/platformio.ini @@ -1,7 +1,7 @@ [env:dbc_test] platform = native ; lib_deps = https://github.com/RCMast3r/pio_dbc_to_cpp.git -lib_deps = ../pio_dbc_to_cpp +lib_deps = ../../../pio_dbc_to_cpp/ ; All path are relative to the `$PROJECT_DIR` user_dbc = + diff --git a/generator/pio_lib_gen.py b/generator/pio_lib_gen.py index c6f80b8..46fddbd 100644 --- a/generator/pio_lib_gen.py +++ b/generator/pio_lib_gen.py @@ -1,14 +1,19 @@ # TODO get and build dbcppp if needed # TODO get dbc file from url or local file # TODO run dbcppp on supplied dbc file - +Import("env") import os import hashlib import pathlib import subprocess -import docker + +try: + import docker +except ImportError: + env.Execute("$PYTHONEXE -m pip install docker") + import docker import SCons.Action import tarfile @@ -16,7 +21,7 @@ # based on https://github.com/nanopb/nanopb/blob/master/generator/platformio_generator.py -Import("env") + python_exe = env.subst("$PYTHONEXE") project_dir = env.subst("$PROJECT_DIR") @@ -51,7 +56,7 @@ def copy_to(src, dst): if not len(dbc_file): - print("[nanopb] ERROR: No file matched pattern:") + print("[dbcpio] ERROR: No file matched pattern:") print(f"user_dbcs: {user_dbc_file}") exit(1) @@ -62,7 +67,11 @@ def copy_to(src, dst): print(abs_path_to_dbc) print(generated_src_dir) +print(docker) client = docker.from_env() -client.containers.run('asdf:asdf', './scr.sh '+drvname+' '+,volumes=[abs_path_to_dbc+":/data"], working_dir='/app') +print(client.api) +print(client.containers) +client.containers.run('ghcr.io/rcmast3r/ccoderdbc:main', './build/coderdbc -rw -noconfig -dbc /data/hytech.dbc -out /out -drvname '+drvname, environment=["PUID=1000", "GUID=1000"],volumes=[abs_path_to_dbc+":/data", generated_src_dir+":/out"], working_dir='/app') + print("hello from lib2") diff --git a/third-party/Dockerfile b/third-party/Dockerfile index 1abb9af..f18436b 100644 --- a/third-party/Dockerfile +++ b/third-party/Dockerfile @@ -27,6 +27,7 @@ RUN apt-get autoremove -y \ # Set an entrypoint if needed # ENTRYPOINT ["executable"] +VOLUME /out # Set default command if needed # CMD ["command"]