Add tasks for container publishing.

This commit is contained in:
Michael Lipp 2023-06-10 12:46:18 +02:00
parent a79ef7788b
commit 2f6a774139
2 changed files with 65 additions and 7 deletions

View file

@ -32,12 +32,46 @@ application {
mainClass = 'org.jdrupes.vmoperator.runner.qemu.Runner' mainClass = 'org.jdrupes.vmoperator.runner.qemu.Runner'
} }
distributions { task buildArchContainer(type: Exec) {
main { dependsOn installDist
//distributionBaseName = 'runner-qemu' inputs.files 'src/org/jdrupes/vmoperator/runner/qemu/Containerfile.arch'
// contents {
// from 'src/readme' commandLine 'podman', 'build', '-t', "${project.name}:${project.version}",\
// } '-f', 'src/org/jdrupes/vmoperator/runner/qemu/Containerfile.arch', '.'
} }
task tagArchContainer(type: Exec) {
dependsOn buildArchContainer
commandLine 'podman', 'tag', "${project.name}:${project.version}",\
"${project.name}:latest"
}
task buildContainer {
dependsOn buildArchContainer
dependsOn tagArchContainer
}
task pushArchContainer(type: Exec) {
dependsOn buildContainer
commandLine 'podman', 'push', '--tls-verify=false', \
"localhost/${project.name}:${project.version}", \
"${project.rootProject.properties['docker.registry']}" \
+ "/vmoperator/${project.name}:${project.version}"
}
task pushArchContainerAsLatest(type: Exec) {
dependsOn buildContainer
commandLine 'podman', 'push', '--tls-verify=false', \
"localhost/${project.name}:${project.version}", \
"${project.rootProject.properties['docker.registry']}" \
+ "/vmoperator/${project.name}:latest"
}
task pushContainer {
dependsOn pushArchContainer
dependsOn pushArchContainerAsLatest
} }

View file

@ -0,0 +1,24 @@
FROM archlinux/archlinux
RUN systemd-firstboot --setup-machine-id
RUN pacman -Suy --noconfirm \
&& pacman -S --noconfirm which qemu-base virtiofsd \
edk2-ovmf swtpm iproute2 bridge-utils jre17-openjdk-headless \
&& pacman -Scc --noconfirm
# Remove all targets.
RUN (cd /lib/systemd/system/sysinit.target.wants/; \
for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*; \
systemctl set-default multi-user.target
COPY build/install/vm-runner.qemu /opt/vmrunner
CMD ["/opt/vmrunner/bin/vm-runner.qemu"]