From e99d8cecd480b9534c531163c9f9980e2da5d62f Mon Sep 17 00:00:00 2001 From: Andrey Elizarov Date: Tue, 14 May 2024 20:13:02 +0400 Subject: [PATCH] update cli --- Dockerfile.cli | 8 +++++--- extras.cli/docker-entrypoint.sh | 13 +++++++++++++ make-cli.sh | 18 +++++++++--------- 3 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 extras.cli/docker-entrypoint.sh diff --git a/Dockerfile.cli b/Dockerfile.cli index ebbbe70..6dc1684 100644 --- a/Dockerfile.cli +++ b/Dockerfile.cli @@ -5,12 +5,14 @@ RUN set -eux \ && apk add --no-cache git \ # installs right from tarball from the github. still needs 'git' tho. && npm install -g --save "https://github.com/vigilancer/ergogen/tarball/myfork" \ + # needed to rebuild ergogen dist with new footprints + && npm install -g --save rollup @rollup/plugin-json @rollup/plugin-commonjs \ # saves around 23MB && rm -rf /root/.npm +COPY --chmod=777 extras.cli/docker-entrypoint.sh /docker-entrypoint.sh + VOLUME ["/work/output", "/work/input"] WORKDIR /work -ENTRYPOINT ["ergogen"] - -CMD ["/work/input/keyboard.yaml", "--clean", "--debug", "--output=/work/output"] \ No newline at end of file +ENTRYPOINT ["/docker-entrypoint.sh"] \ No newline at end of file diff --git a/extras.cli/docker-entrypoint.sh b/extras.cli/docker-entrypoint.sh new file mode 100644 index 0000000..abf0245 --- /dev/null +++ b/extras.cli/docker-entrypoint.sh @@ -0,0 +1,13 @@ + +main() { + echo "Rebuilding ergogen with new footprints" + npm run --prefix=/usr/local/lib/node_modules/ergogen/ build + + if [ $# -gt 0 ]; then + ergogen "$@" + else + ergogen /work/input/keyboard.yaml --clean --debug --output=/work/output + fi +} + +main "$@" \ No newline at end of file diff --git a/make-cli.sh b/make-cli.sh index 7f2b86f..77cc935 100755 --- a/make-cli.sh +++ b/make-cli.sh @@ -31,15 +31,15 @@ ergogen_build() { ergogen_run() { local args="${1:-}" local cmd=" - docker run \ - -it \ - --rm \ - --init \ - --name ergogen-cli \ - -v $(pwd)/footprints:/usr/local/lib/node_modules/ergogen/src/footprints \ - -v $(pwd)/input:/work/input \ - -v $(pwd)/output:/work/output \ - ergogen-cli:latest + docker run \ + -it \ + --rm \ + --init \ + --name ergogen-cli \ + -v $(pwd)/footprints:/usr/local/lib/node_modules/ergogen/src/footprints \ + -v $(pwd)/input:/work/input \ + -v $(pwd)/output:/work/output \ + ergogen-cli:latest " [ ! -z "$args" ] && cmd="$cmd $args"