feat: add CI for alpine docker image (#70)
diff --git a/.github/workflows/linux_alpine_ci.yaml b/.github/workflows/linux_alpine_ci.yaml
new file mode 100644
index 0000000..53c3876
--- /dev/null
+++ b/.github/workflows/linux_alpine_ci.yaml
@@ -0,0 +1,15 @@
+name: Docker compose CI on linux
+
+on:
+ push:
+ branches: [ master, kv/alpine ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: use docker-compose
+ run: cd ./example && sh gen-config-yaml.sh && docker-compose -f docker-compose-alpine.yml -p docker-apisix up -d
diff --git a/.github/workflows/linux_ci.yml b/.github/workflows/linux_ci.yml
index dc15281..aec9dd9 100644
--- a/.github/workflows/linux_ci.yml
+++ b/.github/workflows/linux_ci.yml
@@ -12,4 +12,4 @@
steps:
- uses: actions/checkout@v2
- name: use docker-compose
- run: cd ./example && docker-compose -p docker-apisix up -d
+ run: cd ./example && sh gen-config-yaml.sh && docker-compose -p docker-apisix up -d
diff --git a/example/README.md b/example/README.md
index cdd8d92..ca3d8af 100644
--- a/example/README.md
+++ b/example/README.md
@@ -1,9 +1,7 @@
### Run
```
-$ chmod +x gen-config-yaml.sh
-$ sh gen-config-yaml.sh
-$ docker-compose -p docker-apisix up -d
+$ sh gen-config-yaml.sh && docker-compose -p docker-apisix up -d
```
### Configure
diff --git a/example/docker-compose-alpine.yml b/example/docker-compose-alpine.yml
new file mode 100644
index 0000000..e3fa700
--- /dev/null
+++ b/example/docker-compose-alpine.yml
@@ -0,0 +1,66 @@
+version: "3"
+
+services:
+ apisix:
+ build:
+ context: ./..
+ dockerfile: alpine/Dockerfile
+ args:
+ APISIX_VERSION: master
+ restart: always
+ volumes:
+ - ./apisix_log:/usr/local/apisix/logs
+ - ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
+ depends_on:
+ - etcd
+ ports:
+ - "9080:9080/tcp"
+ - "9443:9443/tcp"
+ networks:
+ apisix:
+ ipv4_address: 172.18.5.11
+
+ etcd:
+ image: bitnami/etcd:3.4.9
+ user: root
+ restart: always
+ volumes:
+ - ./etcd_data:/etcd_data
+ environment:
+ ETCD_DATA_DIR: /etcd_data
+ ETCD_ENABLE_V2: "true"
+ ALLOW_NONE_AUTHENTICATION: "yes"
+ ETCD_ADVERTISE_CLIENT_URLS: "http://0.0.0.0:2379"
+ ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379"
+ ports:
+ - "2379:2379/tcp"
+ networks:
+ apisix:
+ ipv4_address: 172.18.5.10
+
+ web1:
+ image: ruby:2-alpine
+ command: sh -c "mkdir -p /tmp/www && echo 'web1' > /tmp/www/web1.txt && ruby -run -ehttpd /tmp/www -p8000"
+ restart: always
+ ports:
+ - "9081:8000/tcp"
+ networks:
+ apisix:
+ ipv4_address: 172.18.5.12
+
+ web2:
+ image: ruby:2-alpine
+ command: sh -c "mkdir -p /tmp/www && echo 'web2' > /tmp/www/web2.txt && ruby -run -ehttpd /tmp/www -p8000"
+ restart: always
+ ports:
+ - "9082:8000/tcp"
+ networks:
+ apisix:
+ ipv4_address: 172.18.5.13
+
+networks:
+ apisix:
+ driver: bridge
+ ipam:
+ config:
+ - subnet: 172.18.0.0/16
diff --git a/example/docker-compose.yml b/example/docker-compose.yml
index d94eb70..109626b 100644
--- a/example/docker-compose.yml
+++ b/example/docker-compose.yml
@@ -1,6 +1,7 @@
version: "3"
services:
+
apisix:
build:
context: ./..
diff --git a/example/gen-config-yaml.sh b/example/gen-config-yaml.sh
old mode 100644
new mode 100755
index 7a59529..07a81ab
--- a/example/gen-config-yaml.sh
+++ b/example/gen-config-yaml.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-export etcd_url='http://172.18.5.10:2379'
+export etcd_url='http://etcd:2379'
wget https://raw.githubusercontent.com/apache/apisix/master/conf/config-default.yaml -O config.yaml