Skip to content

Commit 86968b3

Browse files
authored
feat: add CI for alpine docker image (#70)
1 parent 6ac41f4 commit 86968b3

File tree

6 files changed

+85
-5
lines changed

6 files changed

+85
-5
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Docker compose CI on linux
2+
3+
on:
4+
push:
5+
branches: [ master, kv/alpine ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: use docker-compose
15+
run: cd ./example && sh gen-config-yaml.sh && docker-compose -f docker-compose-alpine.yml -p docker-apisix up -d

.github/workflows/linux_ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v2
1414
- name: use docker-compose
15-
run: cd ./example && docker-compose -p docker-apisix up -d
15+
run: cd ./example && sh gen-config-yaml.sh && docker-compose -p docker-apisix up -d

example/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
### Run
22

33
```
4-
$ chmod +x gen-config-yaml.sh
5-
$ sh gen-config-yaml.sh
6-
$ docker-compose -p docker-apisix up -d
4+
$ sh gen-config-yaml.sh && docker-compose -p docker-apisix up -d
75
```
86

97
### Configure

example/docker-compose-alpine.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
version: "3"
2+
3+
services:
4+
apisix:
5+
build:
6+
context: ./..
7+
dockerfile: alpine/Dockerfile
8+
args:
9+
APISIX_VERSION: master
10+
restart: always
11+
volumes:
12+
- ./apisix_log:/usr/local/apisix/logs
13+
- ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
14+
depends_on:
15+
- etcd
16+
ports:
17+
- "9080:9080/tcp"
18+
- "9443:9443/tcp"
19+
networks:
20+
apisix:
21+
ipv4_address: 172.18.5.11
22+
23+
etcd:
24+
image: bitnami/etcd:3.4.9
25+
user: root
26+
restart: always
27+
volumes:
28+
- ./etcd_data:/etcd_data
29+
environment:
30+
ETCD_DATA_DIR: /etcd_data
31+
ETCD_ENABLE_V2: "true"
32+
ALLOW_NONE_AUTHENTICATION: "yes"
33+
ETCD_ADVERTISE_CLIENT_URLS: "http://0.0.0.0:2379"
34+
ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379"
35+
ports:
36+
- "2379:2379/tcp"
37+
networks:
38+
apisix:
39+
ipv4_address: 172.18.5.10
40+
41+
web1:
42+
image: ruby:2-alpine
43+
command: sh -c "mkdir -p /tmp/www && echo 'web1' > /tmp/www/web1.txt && ruby -run -ehttpd /tmp/www -p8000"
44+
restart: always
45+
ports:
46+
- "9081:8000/tcp"
47+
networks:
48+
apisix:
49+
ipv4_address: 172.18.5.12
50+
51+
web2:
52+
image: ruby:2-alpine
53+
command: sh -c "mkdir -p /tmp/www && echo 'web2' > /tmp/www/web2.txt && ruby -run -ehttpd /tmp/www -p8000"
54+
restart: always
55+
ports:
56+
- "9082:8000/tcp"
57+
networks:
58+
apisix:
59+
ipv4_address: 172.18.5.13
60+
61+
networks:
62+
apisix:
63+
driver: bridge
64+
ipam:
65+
config:
66+
- subnet: 172.18.0.0/16

example/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
version: "3"
22

33
services:
4+
45
apisix:
56
build:
67
context: ./..

example/gen-config-yaml.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
export etcd_url='http://172.18.5.10:2379'
3+
export etcd_url='http://etcd:2379'
44

55
wget https://raw.githubusercontent.com/apache/apisix/master/conf/config-default.yaml -O config.yaml
66

0 commit comments

Comments
 (0)