Skip to content

Commit

Permalink
update cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Elizarov committed May 14, 2024
1 parent b84752c commit e99d8ce
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
8 changes: 5 additions & 3 deletions Dockerfile.cli
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
ENTRYPOINT ["/docker-entrypoint.sh"]
13 changes: 13 additions & 0 deletions extras.cli/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
18 changes: 9 additions & 9 deletions make-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit e99d8ce

Please sign in to comment.