forked from IBM-Cloud/ibmcloud-image-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.ubuntu
146 lines (131 loc) · 4.48 KB
/
Dockerfile.ubuntu
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
FROM ubuntu:20.04
ARG USERNAME=ubuntu
ARG USER_UID=1000
ARG USER_GID=1000
RUN groupadd --gid $USER_GID $USERNAME && \
useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME
LABEL "maintainer"="SeungYeop Yang"
ARG WDIR=/ibmcloud-image-builder
ENV DEBIAN_FRONTEND noninteractive
ENV TZ America/Central
RUN set -ex && \
apt-get update && \
apt-get install -y \
tzdata \
git \
mercurial \
build-essential \
libssl-dev \
libbz2-dev \
zlib1g-dev \
libffi-dev \
libreadline-dev \
libsqlite3-dev \
curl \
wget \
jq \
vim \
unzip \
iputils-ping \
dnsutils \
qemu-utils \
qemu \
qemu-system-x86 \
cloud-image-utils \
texlive-full \
noweb \
graphviz \
sudo && \
apt-get upgrade -y \
e2fsprogs \
libgcrypt20 \
libgnutls30 && \
apt autoremove -y && \
apt clean -y && \
rm -rf /var/lib/apt/lists/* && \
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \
chmod 0440 /etc/sudoers.d/$USERNAME
# set environmental variables
USER $USERNAME
ENV HOME "/home/${USERNAME}"
ENV LC_ALL "C.UTF-8"
ENV LANG "en_US.UTF-8"
# golang 1.13
RUN set -ex && \
cd ${HOME} && \
wget https://dl.google.com/go/go1.13.9.linux-amd64.tar.gz && \
sudo tar xzf go1.13.9.linux-amd64.tar.gz && \
rm go1.13.9.linux-amd64.tar.gz && \
sudo mv go /usr/local/go-1.13 && \
mkdir -p ${HOME}/go && \
mkdir -p ${HOME}/.terraform.d/plugins && \
sudo chown ${USER_UID}:${USER_GID} ${HOME}/go && \
sudo chown ${USER_UID}:${USER_GID} ${HOME}/.terraform.d/plugins
ENV GOROOT=/usr/local/go-1.13
#ENV GOPATH=${HOME}/go
RUN set -ex && \
git clone https://github.com/tfutils/tfenv.git ~/.tfenv && \
echo 'export GOPATH=${HOME}/go' >> ~/.bashrc && \
echo 'export PATH=$HOME/.tfenv/bin:$PATH' >> ~/.bashrc
ENV PATH=${HOME}/.tfenv/bin:$GOROOT/bin:${HOME}/go/bin:$PATH
# terraform
RUN set -ex && \
cd ${HOME} && \
tfenv install 0.12.29 && \
tfenv install 0.13.2 && \
tfenv use 0.12.29 && \
# ibm provider
wget https://github.com/IBM-Cloud/terraform-provider-ibm/releases/download/v1.12.0/linux_amd64.zip && \
unzip linux_amd64.zip && \
chmod +x terraform-provider-ibm_* && \
sudo mv terraform-provider-ibm_* ~/.terraform.d/plugins && \
rm linux_amd64.zip && \
# shell provider
wget -q https://github.com/scottwinkler/terraform-provider-shell/releases/download/v1.7.3/terraform-provider-shell_1.7.3_linux_amd64.zip && \
unzip terraform-provider-shell_1.7.3_linux_amd64.zip && \
chmod +x terraform-provider-shell_* && \
rm terraform-provider-shell_1.7.3_linux_amd64.zip && \
# packer
wget https://releases.hashicorp.com/packer/1.6.1/packer_1.6.1_linux_amd64.zip && \
unzip packer_1.6.1_linux_amd64.zip && \
chmod +x packer && \
rm packer_1.6.1_linux_amd64.zip && \
sudo mv packer /usr/local/bin && \
# vault
wget https://releases.hashicorp.com/vault/1.4.2/vault_1.4.2_linux_amd64.zip && \
unzip vault_1.4.2_linux_amd64.zip && \
chmod +x vault && \
rm vault_1.4.2_linux_amd64.zip && \
sudo mv vault /usr/local/bin
# ibmcloud cli client
# ibmcloud cli client installs docker
RUN set -ex && \
cd ${HOME} && \
sudo curl -sL https://ibm.biz/idt-installer | bash && \
sudo ibmcloud plugin install vpc-infrastructure -f && \
sudo ibmcloud plugin install cloud-object-storage -f && \
sudo ibmcloud plugin install key-protect && \
sudo ibmcloud plugin install tke && \
# docker-compose 1.25.5
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \
sudo chmod +x /usr/local/bin/docker-compose
ENV PYENV_ROOT "${HOME}/.pyenv"
ENV PATH "${HOME}/.pyenv/shims:${HOME}/.pyenv/bin:${PATH}"
RUN echo 'eval "$(pyenv init -)"' >> ~/.bashrc
RUN echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
COPY requirements.txt ${HOME}/requirements.txt
RUN set -ex && \
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash && \
pyenv install 3.6.9 && \
pyenv global 3.6.9 && \
pip install --upgrade pip && \
pip install -r ${HOME}/requirements.txt && \
rm ${HOME}/requirements.txt && \
sudo mkdir -p /integration-testing
# python 3.6.9
# install python 3.6.9 set 3.6.9 as global
# if you want to try python 3.7.5 or higher, then
# run the docker container
# $ pyenv install 3.7.5
# $ pyenv global 3.7.5
WORKDIR ${WDIR}