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 {
|
2023-05-02 06:42:16 +00:00
|
|
|
Command: null | Array<string>;
|
2022-11-22 13:00:55 +00:00
|
|
|
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">
|
2023-05-02 06:42:16 +00:00
|
|
|
<code>{image.Command ? joinCommand(image.Command) : '-'}</code>
|
2022-12-21 22:09:40 +00:00
|
|
|
</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) => (
|
2023-05-16 05:22:50 +00:00
|
|
|
<span key={index} className="label label-default space-right">
|
2022-12-21 22:09:40 +00:00
|
|
|
{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
|
|
|
);
|
|
|
|
}
|