There is no complete list including everyone
Ethnicity is not always formally defined and attempts to define formal ethnicities are often lacking. For example, the Laotian government has classified the entire population into 49 major ethnic groups divided into 160 ethnic groups. Yet, many feel that their identity has been neglected.
Perhaps it is possible to extract interesting ethnic groups for a medical diagnosis and only list them. The enumeration of the 160 Lao ethnic groups will most likely be unimportant in this context.
Ethnicity can be a very sensitive issue
For example, asking for ethnicity in Sweden could trigger a warning signal about racist intentions.
Explain clearly why you are asking.
Ethnicity does not have strict boundaries (necessarily)
Unlike countries, the external borders of an ethnic group can often be unclear. The group / group to which an individual belongs does not always appear clearly from the point of view of individuals and / or groups. The simple question may seem to exclude if you do not have a group that you strongly identify with, even if it was possible to create a complete list.
You are probably interested only in the biological heritage, not in a sense of social belonging. Make sure to explain it to the user.
Where (and if) you ask depends on why you ask
You must clearly define the purpose of your application for ethnic origin and design. If you are designing a BMI calculator, for example, determine which ethnic groups might be relevant to your calculations and ask them specifically (and clearly explain why you are asking). If, on the other hand, you need to know the customs, holidays, cooking, etc. people, you would probably do better to specifically ask for these.