You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first time you configure automated builds, a default tag mapping is set up for you. This default set builds from the `Branch` in your source code called `master`, and creates a Docker image tagged with `latest`.
81
+
82
+
You can also use a regex to select which source branches or tags to build.
* Specify the **Dockerfile location** as a path relative to the root of the source code repository. (If the Dockerfile is at the repository root, leave this path set to `/`.)
88
93
89
94
9. For each branch or tag, enable or disable the **Autobuild** toggle.
90
95
91
96
Only branches or tags with autobuild enabled are built, tested, *and* have
92
97
the resulting image pushed to the repository. Branches with autobuild
93
-
disabled will be built for testing purposes if enabled, but not pushed.
98
+
disabled will be built for test purposes (if enabled at the repository level), but not pushed.
99
+
100
+
10. For each branch or tag, enable or disable the **Build Caching** toggle.
101
+
102
+
[Build caching](https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#/build-cache) can save time if you are building a large image frequently or have many dependencies. You might want to leave build caching disabled to make sure all of your dependencies are resolved at build time, or if you have a large layer that is quicker to build locally.
94
103
95
-
10. Click **Save** to save the settings, or click **Save and build** to save and
104
+
11. Click **Save** to save the settings, or click **Save and build** to save and
96
105
run an initial test.
97
106
98
107
A webhook is automatically added to your source code repository to notify
@@ -119,12 +128,10 @@ values used by your service (for example to create service links).
119
128
120
129
## Check your active builds
121
130
122
-
1. To view active builds, go to the repository view and click **Timeline**.
131
+
You can view a summary of the last five builds for a repository from the repository's **General** tab. You can also click **Timeline** to view a list of all active builds, and expand each build to see their real-time logs. The **Builds** tab also displays a color coded bar chart of the build queue times and durations.
123
132
124
-
The Timeline displays the pending, in progress, successful and failed builds
125
-
for any tag of the repository.
126
-
127
-
2. Click to expand a timeline entry to check the build logs.
133
+
Both views display the pending, in progress, successful, and failed builds
134
+
for any tag of the repository.
128
135
129
136
You can click the **Cancel** button for pending builds and builds in progress.
130
137
If a build fails, the cancel button is replaced by a **Retry** button.
@@ -153,7 +160,61 @@ to automatically build.
153
160
154
161
5. Click **Save** to save your changes.
155
162
156
-
## Regexes and automated builds
163
+
## Advanced automated build options
164
+
165
+
At the minimum you need a build rule composed of a source branch (or tag) and
166
+
destination Docker tag to set up an automated build. You can also change where
167
+
the build looks for the Dockerfile, set a path to the files the build will use
168
+
(the build context), set up multiple static tags or branches to build from, and
169
+
use regular expressions (regexes) to dynamically select source code to build and
170
+
create dynamic tags.
171
+
172
+
All of these options are available from the **Build configuration** screen for
173
+
each repository. Click **Repositories** from the left navigation, click the name
174
+
of the repository you want to edit, click the **Builds** tab, and click
175
+
**Configure Automated builds**.
176
+
177
+
### Tag and Branch builds
178
+
179
+
You can configure your automated builds so that pushes to specific branches or tags will trigger a build.
180
+
181
+
1. In the **Tag mappings** section, click the plus sign to add more sources to build.
182
+
183
+
2. Select the **Source type** to build: either a **tag** or a **branch**.
184
+
185
+
This tells the build system what type of source to look for in the code
186
+
repository.
187
+
188
+
3. Enter the name of the **Source** branch or tag you want to build.
189
+
190
+
You can enter a name, or use a regex to match which source branch or tag
5. Repeat steps 2 through 4 for each new tag mapping you set up.
201
+
202
+
### Set the build context and Dockerfile location
203
+
204
+
Depending on how the files are arranged in your source code repository, the
205
+
files required to build your images may not be at the repository root. If that's
206
+
the case, you can specify a path where the build looks for the files.
207
+
208
+
The _build context_ is the path to the files needed for the build, relative to the root of the repository. Enter the path to these files in the **Build context** field. Enter `/` to set the build context as the root of the source code repository.
209
+
210
+
> **Note**: If you delete the default path `/` from the **Build context** field and leave it blank, the build system uses the path to the Dockerfile as the build context. However, to avoid confusion we recommend that you specify the complete path.
211
+
212
+
You can specify the **Dockerfile location** as a path relative to the build
213
+
context. If the Dockerfile is at the root of the build context path, leave the
214
+
Dockerfile path set to `/`. (If the build context field is blank, set the path
215
+
to the Dockerfile from the root of the source repository.)
216
+
217
+
### Regexes and automated builds
157
218
158
219
You can specify a regular expression (regex) so that only matching branches or
159
220
tags are built. You can also use the results of the regex to create the Docker
@@ -175,7 +236,7 @@ To do this, specify a `branch` build with the regex `/[0-9.]+$/` in the
175
236
**Source** field, and use the formula `version-{sourceref}` in the **Docker
176
237
tag** field.
177
238
178
-
<!-- Not a priority
239
+
<!--Capture groups Not a priority
179
240
#### Regex example: build from version number branch and tag with version number
180
241
181
242
You could also use capture groups to build and label images that come from various sources. For example, you might have
@@ -197,7 +258,8 @@ To work around this, you can set up your automated build using the `SSH_PRIVATE`
197
258
198
259
1. Generate a SSH keypair that you will use for builds only, and add the public key to your source code provider account.
199
260
200
-
This step is optional, but allows you to revoke the build-only keypair without removing other access. <!-- (TODO: Link to instructions for GH & BB ) -->
261
+
This step is optional, but allows you to revoke the build-only keypair without removing other access.
262
+
201
263
2. Copy the private half of the keypair to your clipboard.
202
264
3. In Docker Cloud, navigate to the build page for the repository that has linked private submodules. (If necessary, follow the steps [here](automated-build.md#configure-automated-build-settings) to configure the automated build.)
203
265
4. At the bottom of the screen, click the plus sign ( **+** ) next to **Build Environment variables**.
0 commit comments