feat: expose -> ports for app:3000 and such

This commit is contained in:
2026-08-16 09:58:02 +07:00 Unverified
parent 83bb9e804d
commit 67462e744b
2 changed files with 26 additions and 4 deletions
Submodule fixtures/erika updated: c1c015ef78...285187ca41
+25 -3
View File
@@ -301,7 +301,7 @@ function toVolumes(
}
function toPorts(service: Service): NormalizedPort[] {
return (
const ports =
service.ports?.flatMap<NormalizedPort>((entry, index) => {
if (typeof entry === "number") {
return [
@@ -355,8 +355,30 @@ function toPorts(service: Service): NormalizedPort[] {
protocol: toProtocol(entry.protocol),
},
];
}) ?? []
);
}) ?? [];
const exposedPorts =
service.expose?.flatMap<NormalizedPort>((entry, index) => {
const [portSpec, protocolSpec] = String(entry).split("/");
const target = toPortNumber(portSpec);
if (!target) return [];
return [
{
name: `expose-${index}`,
containerPort: target,
servicePort: target,
protocol: toProtocol(protocolSpec),
},
];
}) ?? [];
const deduped = new Map<string, NormalizedPort>();
for (const port of [...ports, ...exposedPorts]) {
deduped.set(`${port.containerPort}:${port.protocol}`, port);
}
return [...deduped.values()];
}
function toContainerPorts(