forked from bitrise-io/bitrise-base
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
201 lines (160 loc) · 6.23 KB
/
Copy pathDockerfile
File metadata and controls
201 lines (160 loc) · 6.23 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
FROM ubuntu:16.04
# ------------------------------------------------------
# --- Environments and base directories
# Environments
# - Language
ENV LANG="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8" \
LC_ALL="en_US.UTF-8" \
# - CI
CI="true" \
BITRISE_IO="true" \
# - main dirs
BITRISE_SOURCE_DIR="/bitrise/src" \
BITRISE_BRIDGE_WORKDIR="/bitrise/src" \
BITRISE_DEPLOY_DIR="/bitrise/deploy" \
BITRISE_CACHE_DIR="/bitrise/cache" \
BITRISE_PREP_DIR="/bitrise/prep" \
BITRISE_TMP_DIR="/bitrise/tmp" \
# Configs - tool versions
TOOL_VER_BITRISE_CLI="1.33.0" \
TOOL_VER_RUBY="2.5.1" \
TOOL_VER_GO="1.12.5" \
TOOL_VER_DOCKER="5:18.09.4" \
TOOL_VER_DOCKER_COMPOSE="1.21.2"
# create base dirs
RUN mkdir -p ${BITRISE_SOURCE_DIR} \
&& mkdir -p ${BITRISE_DEPLOY_DIR} \
&& mkdir -p ${BITRISE_CACHE_DIR} \
&& mkdir -p ${BITRISE_TMP_DIR} \
# prep dir
&& mkdir -p ${BITRISE_PREP_DIR}
# switch to temp/prep workdir, for the duration of the provisioning
WORKDIR ${BITRISE_PREP_DIR}
# ------------------------------------------------------
# --- Base pre-installed tools
RUN apt-get update -qq
# Generate proper EN US UTF-8 locale
# Install the "locales" package - required for locale-gen
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
locales \
# Do Locale gen
&& locale-gen en_US.UTF-8
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install \
# Requiered for Bitrise CLI
git \
mercurial \
curl \
wget \
rsync \
sudo \
expect \
# Python
python \
python-dev \
python-pip \
# Common, useful
build-essential \
zip \
unzip \
tree \
clang \
imagemagick \
groff \
# For PPAs
software-properties-common
# ------------------------------------------------------
# --- Pre-installed but not through apt-get
# install AWSCLI from pip
RUN ["pip", "install", "awscli"]
# install Ruby from source
# from source: mainly because of GEM native extensions,
# this is the most reliable way to use Ruby on Ubuntu if GEM native extensions are required
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install \
build-essential \
zlib1g-dev \
libssl-dev \
libreadline6-dev \
libyaml-dev \
libsqlite3-dev \
&& mkdir -p /tmp/ruby-inst \
&& cd /tmp/ruby-inst \
&& wget -q http://cache.ruby-lang.org/pub/ruby/ruby-${TOOL_VER_RUBY}.tar.gz \
&& tar -xvzf ruby-${TOOL_VER_RUBY}.tar.gz \
&& cd ruby-${TOOL_VER_RUBY} \
&& ./configure --prefix=/usr/local && make && make install \
# cleanup
&& cd / \
&& rm -rf /tmp/ruby-inst \
&& gem update --system --no-document
RUN [ -x "$(command -v bundle)" ] || gem install bundler --no-document
# install Go
# from official binary package
RUN wget -q https://storage.googleapis.com/golang/go${TOOL_VER_GO}.linux-amd64.tar.gz -O go-bins.tar.gz \
&& tar -C /usr/local -xvzf go-bins.tar.gz \
&& rm go-bins.tar.gz
# ENV setup
ENV PATH $PATH:/usr/local/go/bin
# Go Workspace dirs & envs
# From the official Golang Dockerfile
# https://github.com/docker-library/golang
ENV GOPATH /bitrise/go
ENV PATH $GOPATH/bin:$PATH
# 755 because Ruby complains if 777 (warning: Insecure world writable dir ... in PATH)
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 755 "$GOPATH"
# Install NodeJS
# from official docs: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
RUN curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
RUN sudo apt-get install -y nodejs
# Install Yarn
# as described at: https://yarnpkg.com/en/docs/install#linux-tab
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
RUN DEBIAN_FRONTEND=noninteractive apt-get update -qq && sudo apt-get install -y yarn
# Install docker
# as described at: https://docs.docker.com/engine/installation/linux/ubuntu/
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
apt-transport-https \
ca-certificates
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
RUN sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& DEBIAN_FRONTEND=noninteractive apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-cache policy docker-ce \
# For available docker-ce versions
# you can run `sudo apt-get update && sudo apt-cache policy docker-ce`
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
docker-ce=${TOOL_VER_DOCKER}~3-0~ubuntu-xenial
# docker-compose
RUN wget -q https://github.com/docker/compose/releases/download/${TOOL_VER_DOCKER_COMPOSE}/docker-compose-`uname -s`-`uname -m` -O /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/docker-compose \
&& docker-compose --version
# ------------------------------------------------------
# --- Bitrise CLI
#
# Install Bitrise CLI
RUN wget -q https://github.com/bitrise-io/bitrise/releases/download/${TOOL_VER_BITRISE_CLI}/bitrise-$(uname -s)-$(uname -m) -O /usr/local/bin/bitrise \
&& chmod +x /usr/local/bin/bitrise \
&& bitrise setup \
&& bitrise envman -version \
&& bitrise stepman -version \
# setup the default StepLib collection to stepman, for a pre-warmed
# cache for the StepLib
&& bitrise stepman setup -c https://github.com/bitrise-io/bitrise-steplib.git \
&& bitrise stepman update
# ------------------------------------------------------
# --- SSH config
COPY ./ssh/config /root/.ssh/config
# ------------------------------------------------------
# --- Git config
RUN git config --global user.email "please-set-your-email@bitrise.io" \
&& git config --global user.name "J. Doe (https://devcenter.bitrise.io/builds/setting-your-git-credentials-on-build-machines/)"
# ------------------------------------------------------
# --- Git LFS
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install git-lfs \
&& git lfs install
# ------------------------------------------------------
# --- Cleanup, Workdir and revision
WORKDIR $BITRISE_SOURCE_DIR
ENV BITRISE_DOCKER_REV_NUMBER_BASE v2019_08_28_1
CMD bitrise --version