I wanted to ask you, @dmacvicar, if you be interested in a couple docker examples? It might help people who want to try out your plugin and adds a easy of use for users. I also found it helpful when I need to manually build your plugin to test out new features, like the 0.12 release.
Here are some examples below:
Build plugin for Alpine images:
# Building Libvirt Plugin Docker
FROM golang:alpine
# Update APK
RUN apk update && apk upgrade
# Install Dependencies
RUN apk add git make pkgconfig libvirt gcc libvirt-dev libc-dev
# Debugging packages
RUN apk add file nano
RUN go get -u golang.org/x/lint/golint
RUN go get github.com/dmacvicar/terraform-provider-libvirt
WORKDIR $GOPATH/src/github.com/dmacvicar/terraform-provider-libvirt
RUN make build
Build plugin for Debian based images(Ubuntu, Debian, etc):
# Building Libvirt Plugin Docker
FROM golang:stretch
# Update APK
RUN apt-get update -y && apt-get upgrade -y
# Install Dependencies
RUN apt-get install git make pkg-config libvirt0 gcc libvirt-dev libc-dev -y
# Debugging packages
RUN apt-get install file nano -y
RUN go get -u golang.org/x/lint/golint
RUN go get github.com/dmacvicar/terraform-provider-libvirt
WORKDIR $GOPATH/src/github.com/dmacvicar/terraform-provider-libvirt
RUN make build
Run Terraform 0.12 and Libvirt plugin on Ubuntu 18.04:
# Grab the Terraform binary
FROM hashicorp/terraform:0.12.5 AS terraform
# Grab the Libvirt plugin binary
FROM terraform-libvirt:latest AS libvirt
FROM ubuntu:18.04
# Set working dir
WORKDIR /root/
# Install Dependencies
RUN apt-get update -y
# Dependencies for Libvirt Plugin
RUN apt-get install dbus dmeventd dmsetup libapparmor1 libavahi-client3 libavahi-common-data libavahi-common3 libdbus-1-3 libdevmapper-event1.02.1 libdevmapper1.02.1 liblvm2app2.2 liblvm2cmd2.02 libnl-3-200 libnuma1 libreadline5 libvirt0 libyajl2 lvm2 readline-common -y
# Dependencies for Local Use(Optional)
RUN apt-get install wget git sshpass gettext python3 python3-pip xsltproc mkisofs -y
# Copy Terraform binary to image
COPY --from=terraform /bin/terraform /bin/
# Copy provider plugin to image(ONLY for x86, could adpat for multi-arch)
RUN mkdir -p /root/.terraform.d/plugins/linux_amd64/
COPY --from=libvirt /go/src/github.com/dmacvicar/terraform-provider-libvirt/terraform-provider-libvirt /root/.terraform.d/plugins/linux_amd64/
# ADD YOUR FILES HERE
COPY example.tf /root/
# Terraform commands
RUN terraform init
ENTRYPOINT /bin/bash
These are all pretty rough Dockerfiles, as I am only using them for quick testing, but I can clean them up and submit a PR if you are interested.
I'm OK to have this unless @dmacvicar thinks the opposite. What I would state in the examples that this aren't maintained by us, in a long-term perspective we will have no prios to maintain them, so no guarantees that they work. E'g what I see as an issue is something like pkg updating and docker etc it is tricky to maintain.
A part of that, we I would like personally to see also openSUSE in that containers. 馃槈
If I think more accurately, I would say that you could create your github repository containing this and we can reference it in the Readme.md file as already other projects are there. To me this seems pretty straightforward and we have the best of the worlds
@MalloZup I have no qualms with openSUSE. What do you guys want to see, Leap or Tumbleweed?
As far as adding them to the repo vs having them in my repo, I am flexible. One thing to note, this account is linked to my IBM account, and if I ever leave I am not sure what happens to it.
My main goal to adding Docker containers was to make it easier for people to use the plugin/play around with it.
@james-crowley thx. Leap I think Is better. I get your point about the repo. OK we can add a directory to this repo and stating this clearly that they are community effort. Feel free to send a pr with a directory and doc needed
Hi @james-crowley
I have nothing against the Dockerfiles, but today we are doing the builds in the Open Build Service for all major distros!. It gives the user lot of confidence on how the build is done. For example, builds are done without internet connection. I dislike the idea of building using Docker in random workstations and pulling half of the internet on each build.
I would not be against a contrib/ directory and having those scripts there. They would need to be maintained, because it could hit us back with "I tried it and did not work" issues.
@dmacvicar We can do what @MalloZup suggested with just putting them on my repo and linking back to it. That way you do not need to worry about issues from users.
I'll make sure to give you guys a heads up if there are changes with my public github account, that way you can fork it if you guys want to keep it around.
Let me clean up some of the examples I been working on and I'll post back here with the link to my repo.
Also, do either of you know where I could find the docker images for Leap or Tumbleweed? Especially, if they have an s390x images. I saw they used to host them on docker hub, but since move to self hosting the images?
My vote would be for a contrib/ folder, it would be much easier to share maintaining that going forward.
Thanks.
I'm ok with the contrib folder . As long we have clear documentation I think we can use it.
@james-crowley
Leap 15.1 -> registry.opensuse.org/opensuse/leap:15.1
Tumbleweed -> registry.opensuse.org/opensuse/tumbleweed:latest
and the registry public is here
https://registry.opensuse.org/cgi-bin/cooverview
@MalloZup Thanks for the links. I am working on the opensuse images right now. I'll make a PR with the contrib folder when done.
You guys can see some stuff I am working on here, https://github.com/james-crowley/terraform-provider-libvirt/tree/docker_examples. Still need to fix some issues and add more docs.
The examples up there now work. I need to document the process and usage, but feel free to test them.
@MalloZup Also, I had to go with tumbleweed as a base image, cause leap seems not to support s390x. Hope that is okay, but I think to do a leap version someone would just need to change the FROM statement from tumbleweed to leap.
@MalloZup Feel free to check out the Docker examples over in my repo, https://github.com/james-crowley/terraform-provider-libvirt/tree/docker_examples. It needs some more cleaning up before a PR, but wanted to see if that style was on point for you guys.
I'm considering this close fix the typo and I will merge it tia!
good work!
Most helpful comment
My vote would be for a
contrib/folder, it would be much easier to share maintaining that going forward.Thanks.