Is there any feasible possibility to use https://docs.docker.com/engine/swarm/secrets/ inside Dockerfile during build time (NOT docker-compose specific .yml file)?
Note: Docker secrets are only available to swarm services, not to standalone containers. To use this feature, consider adapting your container to run as a service with a scale of 1.
The answer is no. Secretes are only available in docker swarm. Swarm doesn't build images and it doesn't accept a Dockerfile.