Skip to content

Commit f9df595

Browse files
committed
add notifier image
1 parent b7ab8c1 commit f9df595

File tree

4 files changed

+59
-2
lines changed

4 files changed

+59
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
env/*
22
worker/tmp/*
3+
notifier/tmp/*
34
app-server/tmp/*

Makefile

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,27 @@ build-app-server:
7070

7171
@echo "\033[1mBuild app-server: done!\033[0m"
7272

73+
build-notifier:
74+
75+
@echo "\033[1mBuild Postgres-CI notifier\033[0m"
76+
77+
@GOROOT=$(shell pwd)/env/go \
78+
GOPATH=$(shell pwd)/env/gopath \
79+
env/go/bin/go get -d -u github.com/postgres-ci/notifier
80+
81+
@cd env/gopath/src/github.com/postgres-ci/notifier && \
82+
$(shell pwd)/env/gopath/bin/gvt restore
83+
84+
@[ -d notifier/tmp/ ] || mkdir notifier/tmp/
85+
86+
@GOROOT=$(shell pwd)/env/go \
87+
GOPATH=$(shell pwd)/env/gopath \
88+
CGO_ENABLED=0 \
89+
env/go/bin/go build -ldflags='-s -w' -o notifier/tmp/notifier \
90+
env/gopath/src/github.com/postgres-ci/notifier/worker.go
91+
92+
@echo "\033[1mBuild notifier: done!\033[0m"
93+
7394
build-worker-image: build-worker
7495

7596
@echo "\033[1mBuild worker docker image\033[0m"
@@ -86,6 +107,14 @@ build-app-server-image: build-app-server
86107

87108
@echo "\033[1mBuild app-server docker image: done!\033[0m"
88109

89-
build: build-worker build-app-server
110+
build-notifier-image: build-notifier
111+
112+
@echo "\033[1mBuild notifier docker image\033[0m"
113+
114+
@cd notifier && docker build -t postgresci/notifier .
115+
116+
@echo "\033[1mBuild notifier docker image: done!\033[0m"
117+
118+
build: build-worker build-app-server build-notifier
90119

91-
all: go build-worker-image build-app-server-image
120+
all: go build-worker-image build-app-server-image build-notifier-image

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
```
55
docker run -d \
66
--name postgres-ci-app-server \
7+
--restart=always \
78
-e DB_HOST=172.16.9.131 \
89
-e DB_USERNAME=postgres_ci \
910
-e DB_PASSWORD=iAmAdiscoDancer \
@@ -13,10 +14,23 @@ docker run -d \
1314
```
1415
docker run -d \
1516
--name postgres-ci-worker \
17+
--restart=always \
1618
-e DB_HOST=172.16.9.131 \
1719
-e DB_USERNAME=postgres_ci \
1820
-e DB_PASSWORD=iAmAdiscoDancer \
1921
-v /var/run/docker.sock:/var/run/docker.sock \
2022
-v /tmp/postgres-ci/builds/:/tmp/postgres-ci/builds/ \
2123
postgresci/worker
24+
```
25+
26+
```
27+
docker run -d \
28+
--name postgres-ci-notifier \
29+
--restart=always \
30+
-e DB_HOST=172.16.9.131 \
31+
-e DB_USERNAME=postgres_ci \
32+
-e DB_PASSWORD=iAmAdiscoDancer \
33+
-e APP_ADDRESS=http://185.143.172.56/ \
34+
-e TELEGRAM_TOKEN=123:SSdd \
35+
postgresci/notifier
2236
```

notifier/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM alpine:3.3
2+
RUN apk add --update ca-certificates && \
3+
rm -rf /var/cache/apk/* /tmp/*
4+
5+
RUN update-ca-certificates
6+
7+
ENV LOG_LEVEL=warning \
8+
DB_PORT=5432 \
9+
DB_DATABASE=postgres_ci
10+
11+
COPY ./tmp/notifier /usr/local/bin/notifier
12+
13+
ENTRYPOINT ["/usr/local/bin/notifier"]

0 commit comments

Comments
 (0)