forked from ebarault/docker-aws-codebuild-terraform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
145 lines (120 loc) · 4.82 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
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
FROM ubuntu:16.04
ARG TERRAFORM_VERSION=0.11.14
ARG TERRAGRUNT_VERSION=0.18.7
ARG NODE_VERSION=12.x
ARG AWSCLI_VERSION=1.18.174
ARG GITLFS_VERSION=2.7.2
ARG ANSIBLE_VERSION=2.8.2
ENV DOCKER_VERSION="18.09.8" \
DIND_COMMIT="37498f009d8bf25fbb6199e8ccd34bed84f2874b" \
DOCKER_COMPOSE_VERSION="1.24.1"
RUN apt-get update && \
# Install add-apt-repository
apt-get install -y --no-install-recommends \
software-properties-common && \
# Update git and install utils
add-apt-repository ppa:git-core/ppa && \
apt-get update && \
apt-get install -y --no-install-recommends \
wget curl git openssh-client jq python python-dev build-essential make \
ca-certificates tar gzip zip unzip bzip2 gettext-base rsync \
gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \
libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 \
libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 \
libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 \
libxi6 libxrandr2 libxrender1 libxss1 libxtst6 fonts-liberation \
libappindicator1 libnss3 lsb-release xdg-utils wget locales && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
# Set the locale
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# Install Nodejs
RUN curl -sL https://deb.nodesource.com/setup_"$NODE_VERSION" | bash -
RUN apt-get install -y --no-install-recommends nodejs
# Install Yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && \
apt-get install yarn
# Install pip
RUN wget "https://bootstrap.pypa.io/get-pip.py" -O /tmp/get-pip.py && \
python /tmp/get-pip.py
# Install Ansible
RUN pip install "ansible==$ANSIBLE_VERSION"
# Install boto and boto3
# boto is installed from maishsk:develop until https://github.com/boto/boto/pull/3794 is merged
RUN pip install boto3 && \
git clone -b develop https://github.com/maishsk/boto.git && \
cd boto && \
python setup.py install
# Install AWS CLI
RUN pip install awscli=="$AWSCLI_VERSION" && \
rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install AWS ELASTIC BEANSTALK CLI
RUN pip install awsebcli --upgrade
# Install Terraform
RUN curl -sL https://releases.hashicorp.com/terraform/"$TERRAFORM_VERSION"/terraform_"$TERRAFORM_VERSION"_linux_amd64.zip -o terraform_"$TERRAFORM_VERSION"_linux_amd64.zip && \
unzip terraform_"$TERRAFORM_VERSION"_linux_amd64.zip -d /usr/bin && \
chmod +x /usr/bin/terraform
# Install Terragrunt
RUN curl -sL https://github.com/gruntwork-io/terragrunt/releases/download/v"$TERRAGRUNT_VERSION"/terragrunt_linux_amd64 -o /usr/bin/terragrunt && \
chmod +x /usr/bin/terragrunt
# Install Git LFS
RUN curl -sL https://github.com/git-lfs/git-lfs/releases/download/v"$GITLFS_VERSION"/git-lfs-linux-amd64-v"$GITLFS_VERSION".tar.gz -o gitlfs.tar.gz && \
mkdir -p gitlfs && \
tar --extract --file gitlfs.tar.gz --directory gitlfs && \
chmod +x gitlfs/install.sh && \
./gitlfs/install.sh
# Install Splitsh
RUN curl -L https://github.com/splitsh/lite/releases/download/v1.0.1/lite_linux_amd64.tar.gz > splitsh.tar.gz && \
tar -xf splitsh.tar.gz && \
mv splitsh-lite /usr/bin/splitsh && \
rm splitsh.tar.gz
# Install yq
RUN pip install yq
# From docker:18.09.08
RUN set -eux; \
wget -O docker.tgz "https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz"; \
tar --extract \
--file docker.tgz \
--strip-components 1 \
--directory /usr/local/bin/ \
; \
rm docker.tgz; \
\
dockerd --version; \
docker --version
# From docker dind 18.09.08
# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies
RUN set -eux; \
apt-get update && \
apt-get install -y --no-install-recommends \
btrfs-tools \
e2fsprogs \
iptables \
openssl \
xfsprogs \
xz-utils \
# pigz: https://github.com/moby/moby/pull/35697 (faster gzip implementation)
pigz
# set up subuid/subgid so that "--userns-remap=default" works out-of-the-box
RUN set -x \
&& addgroup dockremap \
&& useradd -g dockremap dockremap \
&& echo 'dockremap:165536:65536' >> /etc/subuid \
&& echo 'dockremap:165536:65536' >> /etc/subgid
# https://github.com/docker/docker/tree/master/hack/dind
ENV DIND_COMMIT 37498f009d8bf25fbb6199e8ccd34bed84f2874b
RUN set -eux; \
wget -O /usr/local/bin/dind "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind"; \
chmod +x /usr/local/bin/dind
# Install Docker with dind support
COPY dockerd-entrypoint.sh /usr/local/bin/
VOLUME /var/lib/docker
EXPOSE 2375 2376
ENTRYPOINT ["dockerd-entrypoint.sh"]
CMD ["sh"]