Skip to content

Commit 829ef9b

Browse files
authored
Merge pull request #26 from buildkite/update-golang-docker-example
Update Golang Docker Example (consistency sweep)
2 parents ec570e3 + 48cadc1 commit 829ef9b

File tree

5 files changed

+58
-34
lines changed

5 files changed

+58
-34
lines changed

.buildkite/pipeline.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
steps:
2-
# group up all the steps that are related to the quality assurance of the code
2+
# Group up all the steps that are related to the quality assurance of the code.
33
- group: ':mag: QA'
44
id: quality_assurance
55
steps:
@@ -11,19 +11,19 @@ steps:
1111
run: app
1212
- key: test
1313
label: ':golang: test'
14-
command:
14+
command:
1515
- go test -v -count=1 -cover ./... -coverprofile=coverage.txt -covermode=atomic
1616
artifact_paths:
17-
- 'coverage.txt' # upload the coverage report as an artifact
17+
- 'coverage.txt' # Upload the coverage report as an artifact.
1818
plugins:
1919
- docker-compose#v5.4.0:
2020
run: app
21-
# build the application after the quality assurance steps are done
21+
# Build the application after the quality assurance steps are done.
2222
- key: build
2323
label: ':golang: build'
2424
command: go build -o dist/app
2525
artifact_paths:
26-
- 'dist/app' # upload the built application as an artifact
26+
- 'dist/app' # Upload the built application as an artifact.
2727
plugins:
2828
- docker-compose#v5.4.0:
2929
run: app

.buildkite/template.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
# Used by the 'Add to Buildkite' button in the readme
21
name: "Golang Docker Example"
2+
description: "An example pipeline that runs and tests a Go project inside Docker using Buildkite."
3+
emoji: ":golang:"
4+
color: "#EFF9FF"
5+
languages:
6+
- "Go"
7+
- "Docker"
38
steps:
49
- label: ":pipeline:"
5-
command: "buildkite-agent pipeline upload"
10+
command: "buildkite-agent pipeline upload"

Licence.md renamed to LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 Buildkite Pty Ltd
3+
Copyright (c) 2025 Buildkite Pty Ltd
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Buildkite Golang Docker Pipeline Example
2+
3+
[![Build status](https://badge.buildkite.com/aab023f2f33ab06766ed6236bc40caf0df1d9448e4f590d0ee.svg?branch=main)](https://buildkite.com/buildkite/golang-docker-example/builds/latest?branch=main)
4+
[![Add to Buildkite](https://img.shields.io/badge/Add%20to%20Buildkite-14CC80)](https://buildkite.com/new)
5+
6+
This repository is an example [Buildkite](https://buildkite.com/) pipeline that runs tests for a [Golang](https://go.dev) project inside [Docker](https://docker.com).
7+
8+
👉 **See this example in action:** [buildkite/golang-docker-example](https://buildkite.com/buildkite/golang-docker-example/builds/latest?branch=main)
9+
10+
[![Add to Buildkite](https://buildkite.com/button.svg)](https://buildkite.com/new)
11+
12+
<a href="https://buildkite.com/buildkite/golang-docker-example/builds/latest?branch=main">
13+
<img width="1491" alt="Screenshot of Buildkite Golang Docker example pipeline" src=".buildkite/screenshot.png" />
14+
</a>
15+
16+
<!-- docs:start -->
17+
18+
## How it works
19+
20+
This example uses a Docker-based workflow to run Go tests:
21+
- The pipeline runs `go test` and `go vet` inside a container.
22+
- The container is defined using [`Dockerfile`](Dockerfile) and [`docker-compose.yml`](docker-compose.yml).
23+
- The Buildkite pipeline uploads steps using `pipeline.yml`.
24+
25+
This is ideal if you want to containerize your builds or match production environments more closely.
26+
27+
## Try it yourself
28+
29+
To use this pattern in your own Go project:
30+
31+
1. Make sure Docker and Docker Compose are installed. See: [Install Docker Compose](https://docs.docker.com/compose/install/)
32+
2. Copy the example config into your repo:
33+
34+
```sh
35+
cd /your/golang/repo
36+
37+
curl -O https://raw.githubusercontent.com/buildkite/golang-docker-example/main/Dockerfile
38+
curl -O https://raw.githubusercontent.com/buildkite/golang-docker-example/main/docker-compose.yml
39+
```
40+
41+
<!-- docs:end -->
42+
43+
## License
44+
45+
See [LICENSE.md](LICENSE.md) (MIT)

Readme.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)