-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile
71 lines (52 loc) · 1.93 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Set to linux or name of OS
ARG OS=linux
# Set to arch name of your system
ARG ARCH=amd64
# Terraform Version
ARG TERRAFORM_VERSION=0.13.2
# Provider Version
ARG VERSION=0.6.2
# Grab the Terraform binary
FROM hashicorp/terraform:$TERRAFORM_VERSION AS terraform
# Get the Libvirt Plugin Docker
FROM ubuntu:18.04 as libvirt
ARG ARCH=amd64
ARG VERSION=0.6.2
# Install Needed Packages
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install \
-y --no-install-recommends \
wget ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /root/
RUN wget https://github.com/dmacvicar/terraform-provider-libvirt/releases/download/v${VERSION}/terraform-provider-libvirt-${VERSION}+git.1585292411.8cbe9ad0.Ubuntu_18.04.amd64.tar.gz \
&& tar xvf terraform-provider-libvirt-${VERSION}+git.1585292411.8cbe9ad0.Ubuntu_18.04.${ARCH}.tar.gz
# Base Image
FROM ubuntu:18.04
ARG OS=linux
ARG ARCH=amd64
ARG VERSION=0.6.2
# Install Dependencies
# libvirt0 is needed to run the provider. xsltproc needed to use XML/XSLT. mkisofs needed to use cloud init images
# ca-certificates to avoid terraform init 509 error. openssh-client to talk to remote libvirt server
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install \
-y --no-install-recommends \
libvirt-dev xsltproc mkisofs ca-certificates openssh-client \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /root/
# Make Directory for Provider Binaries
RUN mkdir -p /root/.local/share/terraform/plugins/registry.terraform.io/dmacvicar/libvirt/${VERSION}/${OS}_${ARCH}/
# Copy binaries from containers
COPY --from=terraform /bin/terraform /bin/
COPY --from=libvirt /root/terraform-provider-libvirt /root/.local/share/terraform/plugins/registry.terraform.io/dmacvicar/libvirt/${VERSION}/${OS}_${ARCH}/
# Copy Terraform Files
# COPY libvirt.tf /root/
# Terraform commands
# RUN terraform init
# ENTRYPOINT /bin/bash
CMD /bin/terraform