2022-11-28 02:00:28 +00:00
|
|
|
import { List } from 'lucide-react';
|
2022-11-22 13:00:55 +00:00
|
|
|
|
|
|
|
import { joinCommand } from '@/docker/filters/utils';
|
|
|
|
import { getPairKey, getPairValue } from '@/portainer/filters/filters';
|
|
|
|
|
|
|
|
import { TableContainer, TableTitle } from '@@/datatables';
|
|
|
|
import { DetailsTable } from '@@/DetailsTable';
|
|
|
|
|
|
|
|
interface DockerImage {
|
|
|
|
Command: Array<string>;
|
|
|
|
Entrypoint: Array<string>;
|
|
|
|
ExposedPorts: Array<number>;
|
|
|
|
Volumes: Array<string>;
|
|
|
|
Env: Array<string>;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
image: DockerImage;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function DockerfileDetails({ image }: Props) {
|
|
|
|
return (
|
2022-12-21 22:09:40 +00:00
|
|
|
<TableContainer>
|
|
|
|
<TableTitle label="Dockerfile details" icon={List} />
|
|
|
|
<DetailsTable>
|
|
|
|
<DetailsTable.Row label="CMD">
|
|
|
|
<code>{joinCommand(image.Command)}</code>
|
|
|
|
</DetailsTable.Row>
|
2022-11-22 13:00:55 +00:00
|
|
|
|
2022-12-21 22:09:40 +00:00
|
|
|
{image.Entrypoint && (
|
|
|
|
<DetailsTable.Row label="ENTRYPOINT">
|
|
|
|
<code>{joinCommand(image.Entrypoint)}</code>
|
|
|
|
</DetailsTable.Row>
|
|
|
|
)}
|
2022-11-22 13:00:55 +00:00
|
|
|
|
2022-12-21 22:09:40 +00:00
|
|
|
{image.ExposedPorts.length > 0 && (
|
|
|
|
<DetailsTable.Row label="EXPOSE">
|
|
|
|
{image.ExposedPorts.map((port, index) => (
|
|
|
|
<span className="label label-default space-right" key={index}>
|
|
|
|
{port}
|
|
|
|
</span>
|
|
|
|
))}
|
|
|
|
</DetailsTable.Row>
|
|
|
|
)}
|
2022-11-22 13:00:55 +00:00
|
|
|
|
2022-12-21 22:09:40 +00:00
|
|
|
{image.Volumes.length > 0 && (
|
|
|
|
<DetailsTable.Row label="VOLUME">
|
|
|
|
<div className="flex flex-wrap gap-1">
|
|
|
|
{image.Volumes.map((volume, index) => (
|
|
|
|
<span
|
|
|
|
key={index}
|
|
|
|
className="label label-default space-right"
|
|
|
|
ng-repeat="volume in image.Volumes"
|
|
|
|
>
|
|
|
|
{volume}
|
|
|
|
</span>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
</DetailsTable.Row>
|
|
|
|
)}
|
2022-11-22 13:00:55 +00:00
|
|
|
|
2022-12-21 22:09:40 +00:00
|
|
|
{image.Env.length > 0 && (
|
|
|
|
<DetailsTable.Row label="ENV">
|
2023-02-12 21:04:24 +00:00
|
|
|
<table className="table-bordered table-condensed table">
|
2022-12-21 22:09:40 +00:00
|
|
|
<tbody>
|
|
|
|
{image.Env.map((variable) => (
|
|
|
|
<tr key={variable}>
|
|
|
|
<td>{getPairKey(variable, '=')}</td>
|
|
|
|
<td>{getPairValue(variable, '=')}</td>
|
|
|
|
</tr>
|
|
|
|
))}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</DetailsTable.Row>
|
|
|
|
)}
|
|
|
|
</DetailsTable>
|
|
|
|
</TableContainer>
|
2022-11-22 13:00:55 +00:00
|
|
|
);
|
|
|
|
}
|