Add tasks for container publishing.
This commit is contained in:
parent
a79ef7788b
commit
2f6a774139
2 changed files with 65 additions and 7 deletions
|
|
@ -32,12 +32,46 @@ application {
|
|||
mainClass = 'org.jdrupes.vmoperator.runner.qemu.Runner'
|
||||
}
|
||||
|
||||
distributions {
|
||||
main {
|
||||
//distributionBaseName = 'runner-qemu'
|
||||
// contents {
|
||||
// from 'src/readme'
|
||||
// }
|
||||
}
|
||||
task buildArchContainer(type: Exec) {
|
||||
dependsOn installDist
|
||||
inputs.files 'src/org/jdrupes/vmoperator/runner/qemu/Containerfile.arch'
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue