RunpodR
Runpod8mo ago
Tony

environment variables

how to get environment variables while build?

I set variables in endpoint settings, but they are not available during build.
Please tell me if I missed something?



...
RUN python setup.py

# copy models
COPY ./models .

# Entrypoint
CMD ["python", "-u", "handler.py"]


use_auth_token = os.getenv("HF_TOKEN")
print(f"Downloading model - {use_auth_token}")

snapshot_download(...)


result:
[INFO] #13 13.75 Downloading model - None
Screenshot_2025-05-05_at_14.32.06.png
Solution
You can either build the Docker image yourself, push to a docker registry and deploy from there. Or if you want to use the Github Integration you need to put your key inside the Dockerfile, this is the current solution.
Was this page helpful?