diff --git a/servers/bwh-hk-dc3/litellm/Dockerfile b/servers/bwh-hk-dc3/litellm/Dockerfile new file mode 100644 index 0000000..d81d875 --- /dev/null +++ b/servers/bwh-hk-dc3/litellm/Dockerfile @@ -0,0 +1,9 @@ +FROM ghcr.io/berriai/litellm:main-stable + +USER root +RUN apk add --no-cache coreutils + +COPY vertex-entrypoint.sh /app/vertex-entrypoint.sh +RUN chmod 0755 /app/vertex-entrypoint.sh + +ENTRYPOINT ["/app/vertex-entrypoint.sh"] diff --git a/servers/bwh-hk-dc3/litellm/compose.yaml b/servers/bwh-hk-dc3/litellm/compose.yaml index ad6d054..eecf534 100644 --- a/servers/bwh-hk-dc3/litellm/compose.yaml +++ b/servers/bwh-hk-dc3/litellm/compose.yaml @@ -1,6 +1,7 @@ services: litellm: - image: ghcr.io/berriai/litellm:main-stable + build: . + image: local/litellm-vertex:main-stable restart: unless-stopped ports: - "${LISTEN_IP:-127.0.0.1}:${HOST_PORT:-4000}:4000" @@ -12,19 +13,7 @@ services: LITELLM_MASTER_KEY: ${LITELLM_MASTER_KEY} volumes: - ./config.yaml:/app/config.yaml:ro - - ./runtime:/runtime - entrypoint: ["python3", "-c"] - command: - - | - import base64, os - log_fd = os.open("/runtime/litellm.log", os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600) - os.dup2(log_fd, 1) - os.dup2(log_fd, 2) - path = "/tmp/application_default_credentials.json" - with open(path, "wb") as credential_file: - credential_file.write(base64.b64decode(os.environ["GOOGLE_ADC_B64"])) - os.chmod(path, 0o600) - os.execvp("litellm", ["litellm", "--config", "/app/config.yaml", "--host", "0.0.0.0", "--port", "4000"]) + command: ["--config", "/app/config.yaml", "--host", "0.0.0.0", "--port", "4000"] logging: driver: json-file options: diff --git a/servers/bwh-hk-dc3/litellm/runtime/.gitignore b/servers/bwh-hk-dc3/litellm/runtime/.gitignore deleted file mode 100644 index d6b7ef3..0000000 --- a/servers/bwh-hk-dc3/litellm/runtime/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/servers/bwh-hk-dc3/litellm/vertex-entrypoint.sh b/servers/bwh-hk-dc3/litellm/vertex-entrypoint.sh new file mode 100644 index 0000000..d533283 --- /dev/null +++ b/servers/bwh-hk-dc3/litellm/vertex-entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -eu + +umask 077 +printf '%s' "${GOOGLE_ADC_B64}" | base64 -d > "${GOOGLE_APPLICATION_CREDENTIALS}" + +exec /app/docker/prod_entrypoint.sh "$@"