I encountered the exact same issue with Docker secrets file not accessed but I have not figured it out. I followed Using Secrets with Docker | Render, and this is my dockerfile:
FROM node:18.16.0
RUN apt-get update && apt-get install -y python3.11 python3-pip
WORKDIR /app
RUN --mount=type=secret,id=_env,dst=/etc/secrets/.env cat /etc/secrets/.env
RUN addgroup --system app && adduser --ingroup app --home /home/app --shell /bin/sh app
It just did not work, the environment variables were printed in the console during deployment but obviously, when the image was running it had no access to the secrets. Any help is appreciated.