Teleport cannot be placed in a Glyph of Warding
In the spell description for Glyph of Warding, the paragraph regarding placing spells inside the Glyph says this, emphasis mine:
Spell Glyph. You can store a prepared spell of 3rd level or lower in the glyph by casting it as part of creating the glyph. The spell must target a single creature or an area. The spell being stored has no immediate effect when cast in this way...
The spell Teleport, as written, targets "you and up to eight willing additional creatures of your choice", meaning that it is not eligible to be placed in the Glyph.
Traps laid by the DM can do whatever you require them to do
If you're a DM, you should be made aware that while a player creating a Glyph with this effect is prohibited, as DM, you're not required to strictly adhere to the rules set by any individual spell. Call it "Sigil of Arcana", a custom spell that doesn't have this specific limitation, and set it down in a room of the dungeon you're building. Or just make a Teleportation Trap that can be disarmed with Dispel Magic at a DC of 17 (or being cast as a 7th level spell), and forget making it a specific spell at all. You can create the effect you're going for without needing to reconfigure two spells that as-written won't quite do what you need them to do.
As a Player, you need a different spell
Teleportation Circle
Teleportation Circle is an obvious candidate, since it only requires a circle drawn onto the ground, and a Permanent Circle set up somewhere else. It has a smaller radius than Teleport though, meaning you'll be able to target fewer creatures with it. There's also considerable debate over whether Teleportation Circle strictly obeys the constraints for Glyph of Warding or not.
Misty Step
You might be able to get clever by using lots of Glyph of Warding's in the same place. Place a window (no glass or other obstructions) that has visibility of an area outside the tower no more than 30 feet away. Cast Glyph of Warding with your chosen trigger condition, casting Misty Step as the spell to activate, targeting that point with the Misty Step spell each time you do so. Then write conditions for these glyphs:
- On the First Person to enter this room, trigger when that creature sees that all their allies within 20 feet of the room have entered the room.
- On the Second Person to enter this room, trigger when that creature sees that all their allies within 20 feet of the room have entered the room.
- On the Third Person....
This method has a few obvious loopholes:
- Spies, Secret Agents, etc. might be prematurely teleported out
- Blind Characters won't trigger the glyph on themselves
- Other possible work-arounds for this trap
- 30 feet might still be quite close to the room they teleported from
But it should work provided you create enough glyphs to handle an entire enemy party.
Dimension Door/Thunder Step
Same as above, except you need to resolve the debate over whether these spells' abilities to "bring an extra willing creature" interferes with the spell's ability to be put in a Glyph of Warding. I would generally rule it doesn't, but the DM may not feel the same way. If they do rule in your favor, Thunder Step increases the range to 90 feet, Dimension Door increases the range to 500 feet and eliminates the need for line-of-sight.