My service’s Docker build fails because it’s unable to get the environment variables from the secrets file.
I followed the instructions here: Docker secrets
How do I get Render to read the secrets file, without changing my app to read from that path /etc/secrets/.env
just so that it works for Render?
My local build works. I specify the env file “.env” during the build:
docker build --secret id=_env,src=.env -t...
Dockerfile:
# syntax = docker/dockerfile:1.2
FROM python:3.10
WORKDIR /app
RUN --mount=type=secret,id=_env,dst=/etc/secrets/.env cat /etc/secrets/.env
# Install pip requirements
COPY requirements.txt .
RUN python -m pip install --no-cache-dir -r requirements.txt
...
COPY . /app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]