You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/11/01 09:42:03 UTC

[apisix-dashboard] 01/01: feat: added Docker

This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch feat-docker
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git

commit 835807cfb3f1effd92e11c35282c411ec5f5a0fa
Author: juzhiyuan <ju...@apache.org>
AuthorDate: Sun Nov 1 17:41:46 2020 +0800

    feat: added Docker
---
 .dockerignore                     |  1 +
 .github/workflows/test-docker.yml | 23 +++++++++++++++
 Dockerfile                        | 62 +++++++++++++++++++++++++++++++++++++++
 README.md                         |  1 +
 README.zh-CN.md                   |  1 +
 docs/deploy-with-docker.md        |  7 +++++
 docs/deploy-with-docker.zh-CN.md  |  7 +++++
 7 files changed, 102 insertions(+)

diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..cf70988
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1 @@
+**/node_modules
diff --git a/.github/workflows/test-docker.yml b/.github/workflows/test-docker.yml
new file mode 100644
index 0000000..fbb6448
--- /dev/null
+++ b/.github/workflows/test-docker.yml
@@ -0,0 +1,23 @@
+name: Deploy with Docker
+
+on:
+  push:
+    branches:
+      - master
+      - 2.0
+  pull_request:
+    branches:
+      - master
+      - 2.0
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: Run with Docker
+        run: |
+          docker build -t apisix-dashboard:dev .
+          docker run -d -p 8081:8080 apisix-dashboard:dev
+  test:
+    # Check if running up
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..e0ab418
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,62 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+FROM golang:1.14 as api-builder
+
+WORKDIR /go/src/app
+
+COPY ./api .
+
+RUN mkdir -p /go/output/conf \
+    && cp ./conf/*.json /go/output/conf
+
+RUN wget https://github.com/api7/dag-to-lua/archive/v1.1.tar.gz \
+    && tar -zxvf v1.1.tar.gz \
+    && mkdir -p /go/output/dag-to-lua \
+    && mv -u ./dag-to-lua-1.1/lib/* /go/output/dag-to-lua/
+
+RUN go build -o /go/output/manager-api .
+
+FROM node:14-alpine as fe-builder
+
+WORKDIR /frontend/app
+
+COPY ./frontend/package.json .
+
+COPY ./frontend/yarn.lock .
+
+RUN yarn install
+
+COPY ./frontend .
+
+RUN yarn build
+
+FROM alpine:latest as prod
+
+RUN apk update \
+    && apk add lua5.1
+
+WORKDIR /app
+
+COPY --from=api-builder /go/output .
+COPY --from=fe-builder /frontend/output .
+
+EXPOSE 8080
+
+RUN chmod +x ./manager-api
+
+CMD [ "/bin/ash", "-c", "./manager-api" ]
\ No newline at end of file
diff --git a/README.md b/README.md
index 28afe6b..a095d06 100644
--- a/README.md
+++ b/README.md
@@ -30,6 +30,7 @@ Please refer to [User Guide](./docs/USER_GUIDE.md)
 ## Deployment
 
 - [Deploy Manually](./docs/deploy.md)
+- [Deploy with Docker](./docs/deploy-with-docker.md)
 
 ## Development
 
diff --git a/README.zh-CN.md b/README.zh-CN.md
index bf1dd93..67a0cfd 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -30,6 +30,7 @@
 当前支持如下方式部署:
 
 - [手动部署](./docs/deploy.zh-CN.md)
+- [使用 Docker 部署](./docs/deploy-with-docker.zh-CN.md)
 
 ## 开发
 
diff --git a/docs/deploy-with-docker.md b/docs/deploy-with-docker.md
new file mode 100644
index 0000000..088d01d
--- /dev/null
+++ b/docs/deploy-with-docker.md
@@ -0,0 +1,7 @@
+# Deploy with Docker
+
+```sh
+$ docker build -t apisix-dashboard:2.0 .
+```
+
+<!-- TODO -->
\ No newline at end of file
diff --git a/docs/deploy-with-docker.zh-CN.md b/docs/deploy-with-docker.zh-CN.md
new file mode 100644
index 0000000..bca0cb8
--- /dev/null
+++ b/docs/deploy-with-docker.zh-CN.md
@@ -0,0 +1,7 @@
+# 使用 Docker 部署
+
+```sh
+$ docker build -t apisix-dashboard:2.0 .
+```
+
+待补充
\ No newline at end of file