Skip to content

Commit a2bac56

Browse files
authored
Merge pull request #1 from bison/docker-publish
Update Makefile and docker-publish workflow
2 parents 2fc138a + 6a80d05 commit a2bac56

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

.github/workflows/docker-publish.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,7 @@ jobs:
2626
- uses: actions/checkout@v2
2727

2828
- name: Run tests
29-
run: |
30-
if [ -f docker-compose.test.yml ]; then
31-
docker-compose --file docker-compose.test.yml build
32-
docker-compose --file docker-compose.test.yml run sut
33-
else
34-
docker build . --file Dockerfile
35-
fi
29+
run: make
3630

3731
# Push image to GitHub Packages.
3832
# See also https://docs.docker.com/docker-hub/builds/
@@ -50,6 +44,9 @@ jobs:
5044
steps:
5145
- uses: actions/checkout@v2
5246

47+
- name: Build app
48+
run: make build
49+
5350
- name: Build image
5451
run: docker build . --file Dockerfile --tag $IMAGE_NAME
5552

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
VERSION:=$(shell cat VERSION)
22

3+
IMAGE_NAME ?= prometheus-example-app
4+
35
LDFLAGS="-X main.appVersion=$(VERSION)"
46

5-
all:
7+
.PHONY : all build image
8+
9+
all: build image
10+
11+
build:
612
CGO_ENABLED=0 go build -ldflags=$(LDFLAGS) -o prometheus-example-app --installsuffix cgo main.go
7-
docker build -t quay.io/brancz/prometheus-example-app:$(VERSION) .
13+
14+
image: build
15+
docker build -t ghcr.io/rhobs/$(IMAGE_NAME):$(VERSION) .

0 commit comments

Comments
 (0)