Skip to content

Commit 0b0e856

Browse files
committed
Use a github action to build the publisher image
This replaces the previous process of changing the tag in `runbooks/makefile` and running `make docker-push`
1 parent a965631 commit 0b0e856

File tree

3 files changed

+31
-12
lines changed

3 files changed

+31
-12
lines changed

.github/workflows/docker-hub.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish docker image
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
push_to_registry:
9+
name: Push image to docker hub
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: checkout
13+
uses: actions/checkout@v2
14+
- name: Build and push publisher image to docker hub
15+
uses: docker/build-push-action@v1
16+
with:
17+
username: ${{ secrets.DOCKER_USERNAME }}
18+
password: ${{ secrets.DOCKER_PASSWORD }}
19+
path: runbooks
20+
repository: ministryofjustice/cloud-platform-runbooks
21+
tag_with_ref: true

runbooks/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,11 @@ This directory contains the source files for the runbooks hosted at https://runb
44

55
A CircleCI pipeline compiles the source files from this directory to html, and updates the [target repository].
66

7+
## Publisher docker image
8+
9+
A github action builds and pushes the [publisher docker image] to docker hub,
10+
whenever a new [release] is created via the github user interface.
11+
712
[target repository]: https://github.com/ministryofjustice/cloud-platform-runbooks
13+
[publisher docker image]: https://hub.docker.com/repository/docker/ministryofjustice/cloud-platform-runbooks
14+
[release]: https://github.com/ministryofjustice/cloud-platform/releases

runbooks/makefile

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
11
IMAGE := ministryofjustice/cloud-platform-runbooks
2-
VERSION := 1.7 # Change this in .circleci/config.yml if you update it here
32

4-
.built-docker-image: Dockerfile Gemfile Gemfile.lock
5-
docker build -t $(IMAGE) .
6-
touch .built-docker-image
7-
8-
docker-push: .built-docker-image
9-
docker tag $(IMAGE) $(IMAGE):$(VERSION)
10-
docker push $(IMAGE):$(VERSION)
11-
12-
server: .built-docker-image
3+
server:
134
mkdir compiled || true
145
docker run \
156
-p 4567:4567 \
167
-v $$(pwd)/source:/app/source \
178
-v $$(pwd)/compiled:/app/compiled \
189
-v $$(pwd)/config:/app/config \
1910
-it \
20-
$(IMAGE):$(VERSION) bundle exec middleman server
11+
$(IMAGE) bundle exec middleman server
2112

2213
# The CircleCI build pipeline does this, so it should never
2314
# be necessary to run this task. I'm leaving it here for
2415
# reference, and in case we ever need to push changes
2516
# manually.
26-
build: .built-docker-image
17+
build:
2718
mkdir compiled || true
2819
docker run \
2920
-v $$(pwd)/source:/app/source \

0 commit comments

Comments
 (0)