fix: wrap official LiteLLM entrypoint for ADC
This commit is contained in:
@@ -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"]
|
||||
@@ -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:
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -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 "$@"
|
||||
Reference in New Issue
Block a user