Yeah, ideally you’d have a public front-end and then your back-end database would be secured and not publicly accessible.
You could use something like Docker secrets or other type of secrets management. Though honestly this is most likely overkill and if you are worried about security simply having Vaultwarden only locally accessible behind a VPN would be fine.
All data is encrypted locally client side anyways so worst case if your Bitwarden/Vaultwarden server was compromised not much lost either way.
Not an ideal day but not the worst case scenario either IMO.
Also, you could use Postgres or MariaDB/MySQL, those have a password to connect, and i think one of those support encryption at rest, but not sure if that is also available for the community versions.