We sometimes talk to people outside any faith community as if they are supposed to know the ten commandments and follow them.
Who were the commandments originally intended for?
The Israelites then (and Jews today) do no proselytize. What non-believers do is up to them, and there should be no effort to convert them. Setting an example for them to follow, should they so choose, is one's purpose.
But within the nation of Israel, both Israelites and Gentiles must follow the same law.
(This sounds like proof-texting, but it's intended as somewhere to start studying, not as proof.):
The Sabbath day:
but the seventh day is the Sabbath of the LORD your God. In it you shall do no work: you, nor your son, nor your daughter, nor your male servant, nor your female servant, nor your cattle, nor your stranger who is within your gates. — Exodus 20:10
“This shall be a statute forever for you: In the seventh month, on the tenth day of the month, you shall afflict your souls, and do no work at all, whether a native of your own country or a stranger who dwells among you. — Leviticus 16:29
Commandments and laws in general:
‘You shall therefore keep My statutes and My judgments, and shall not commit any of these abominations, either any of your own nation or any stranger who dwells among you — Leviticus 18:26
‘You shall have the same law for the stranger and for one from your own country; for I am the LORD your God.' ” — Leviticus 24:22
‘One ordinance shall be for you of the assembly and for the stranger who dwells with you, an ordinance forever throughout your generations; as you are, so shall the stranger be before the LORD. ‘One law and one custom shall be for you and for the stranger who dwells with you.' ” — Numbers 15:15–16
‘You shall have one law for him who sins unintentionally, for him who is native-born among the children of Israel and for the stranger who dwells among them. — Numbers 15:29
Gentiles can behave as they wish. But Gentiles that want to associate with the people of God must obey God's laws.