The problem that is not explained enough is that the secrets scope starts and ends within the run command. So in order to make them a permanent config, you need to save them as a temp file and copy them in your destination:
RUN --mount=type=secret,id=config,target=<DISK_CONFIG> \
--mount=type=secret,id=credentials,target=<DISC_CREDENTIALS> \
cp <TEMP_CONFIG> <PERMANENT_CONFIG_LOCATION> && cp <TEMP_CREDENTIALS> <PERMANENT_CREDENTIALS_LOCATION>
Feel free to add a cleaner syntax.