diff --git a/docker-compose.yml b/docker-compose.yml index 2eb0fa38..a55db437 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -136,15 +136,6 @@ services: profiles: - stockfish-analysis - command: - build: - context: docker - dockerfile: command.Dockerfile - volumes: - - ./command:/command - profiles: - - utils - python: build: context: docker diff --git a/docker/command.Dockerfile b/docker/command.Dockerfile deleted file mode 100644 index 9928e980..00000000 --- a/docker/command.Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM messense/cargo-zigbuild:0.18.0 - -WORKDIR /command - -ENTRYPOINT cargo zigbuild --release --target x86_64-apple-darwin diff --git a/lila-docker b/lila-docker index 4117b24e..6994367e 100755 --- a/lila-docker +++ b/lila-docker @@ -7,9 +7,24 @@ if [ ! -z "$GITPOD_WORKSPACE_ID" ]; then export PICFIT_DOMAIN=$(gp url 3001 | cut -c9-) fi +rust_cmd() { + if [ ! -z "$(which rustup)" ]; then + # if the host has rust installed, use it + cargo build --release --manifest-path command/Cargo.toml + ./command/target/release/command "$@" + elif [ "$(uname)" = "Darwin" ]; then + docker run --rm -v "$PWD/command:/command" -w /command messense/cargo-zigbuild:0.18.0 \ + cargo zigbuild --release --target universal2-apple-darwin + ./command/target/universal2-apple-darwin/release/command "$@" + else + docker run --rm -v "$PWD/command:/command" -w /command messense/cargo-zigbuild:0.18.0 \ + cargo zigbuild --release + ./command/target/release/command "$@" + fi +} + run_setup() { - docker compose run --rm command - ./command/target/release/command setup + rust_cmd setup export $(cat .env | xargs) @@ -26,7 +41,7 @@ run_setup() { fi if [ "$IS_GITPOD" = "true" ]; then - ./command/target/debug/command gitpod-welcome + rust_cmd gitpod-welcome fi }