feat: expose -> ports for app:3000 and such
This commit is contained in:
+1
-1
Submodule fixtures/erika updated: c1c015ef78...285187ca41
+25
-3
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user