FROM registry.fedoraproject.org/fedora:43 AS builder
LABEL maintainer="cockpit-devel@lists.fedorahosted.org"
LABEL VERSION=main

ARG VERSION

# This goes into the builder container
RUN dnf install -y 'dnf-command(download)' cpio

# This goes into the final container.  The cockpit- packages can be replaced
# with local builds by the install.sh script later.
RUN dnf install -y \
		--installroot=/build \
		--setopt=install_weak_deps=False \
		--use-host-config \
	cockpit-bridge \
	cockpit-ws \
	coreutils-single \
	openssh-clients \
	sed \
	sscg \
	util-linux-core \
	;

ADD . /container
RUN /container/install.sh

FROM scratch
COPY --from=builder /build /

ADD . /container

LABEL INSTALL="docker run --rm --privileged -v /:/host -e IMAGE=\${IMAGE} \${IMAGE} /container/label-install \${IMAGE}"
LABEL UNINSTALL="docker run --rm --privileged -v /:/host -e IMAGE=\${IMAGE} \${IMAGE} /container/label-uninstall"
LABEL RUN="docker run -d --name \${NAME} --privileged --pid=host -v /:/host -e NAME=\${NAME} -e IMAGE=\${IMAGE} \${IMAGE} /container/label-run"

CMD ["/container/label-run"]
