You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by go...@apache.org on 2021/07/23 10:36:09 UTC

[incubator-inlong] branch master updated: [INLONG-794] add website docker image (#590)

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

gosonzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new b7fb480  [INLONG-794] add website docker image (#590)
b7fb480 is described below

commit b7fb480b8ba92208c7a60effc04d159c6c7305bc
Author: dockerzhang <do...@apache.org>
AuthorDate: Fri Jul 23 18:36:03 2021 +0800

    [INLONG-794] add website docker image (#590)
    
    Co-authored-by: dockerzhang <do...@tencent.com>
---
 inlong-manager/manager-api/pom.xml |  2 +-
 inlong-website/Dockerfile          | 26 ++++++++++++++++
 inlong-website/README.md           | 51 ++++++++-----------------------
 inlong-website/nginx.conf          | 62 ++++++++++++++++++++++++++++++++++++++
 inlong-website/pom.xml             | 42 ++++++++++++++++++++++++++
 5 files changed, 143 insertions(+), 40 deletions(-)

diff --git a/inlong-manager/manager-api/pom.xml b/inlong-manager/manager-api/pom.xml
index 649cc07..3fe7cfa 100644
--- a/inlong-manager/manager-api/pom.xml
+++ b/inlong-manager/manager-api/pom.xml
@@ -27,7 +27,7 @@
     </parent>
 
     <artifactId>manager-api</artifactId>
-    <name>Apache InLong - Manager Web</name>
+    <name>Apache InLong - Manager API</name>
 
     <dependencies>
         <dependency>
diff --git a/inlong-website/Dockerfile b/inlong-website/Dockerfile
new file mode 100644
index 0000000..05854d7
--- /dev/null
+++ b/inlong-website/Dockerfile
@@ -0,0 +1,26 @@
+#
+# 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 nginx
+# add built files from target output
+ARG WEBSITE_FILE
+ADD ${WEBSITE_FILE} /usr/share/nginx/html
+ADD nginx.conf /etc/nginx/nginx.conf
+ENV MANAGER_API_ADDRESS=127.0.0.1:8083
+RUN sed -i "s/manager_api_address/$MANAGER_API_ADDRESS/g" /etc/nginx/nginx.conf
+CMD ["nginx", "-g", "daemon off;"]
diff --git a/inlong-website/README.md b/inlong-website/README.md
index ba72723..6f91991 100644
--- a/inlong-website/README.md
+++ b/inlong-website/README.md
@@ -1,39 +1,12 @@
-# Apache InLong
-This is a console for us to admin the [Apache InLong incubator](https://github.com/apache/incubator-inlong).
-
-## Before use 
-Should check the nodejs has been install. 
-
-## Available Scripts
-Inside the newly created project, you can run some built-in commands:
-
-if never install the node_modules, you should run
-
-### `npm install` or `yarn install` at first.
-
-Runs the app in development mode with `npm run dev` or `yarn dev`. 
-
-If server run success, Browser will Open [http://localhost:8080](http://localhost:8080) to view it in the browser.
-
-The page will reload if you make edits.
-You will also see any lint errors in the console.
-
-### `npm test` or `yarn test`
-
-Launches the test runner in the interactive watch mode.
-See the section about [running tests](https://create-react-app.dev/docs/running-tests/) for more information.
-
-### `npm run build` or `yarn build`
-
-Builds the app for production to the build folder.
-It correctly bundles React in production mode and optimizes the build for the best performance.
-
-The build is minified and the filenames include the hashes.
-Your app is ready to be deployed!
-
-See the section about [deployment](https://create-react-app.dev/docs/deployment/) for more information.
-
-### `npm run analyze` or `yarn analyze`
-
-Analyzes JavaScript bundles using the source maps.
-> You need to run `npm run build` or `yarn build` before analysis.
+## About WebSite
+This is a website console for us to use the [Apache InLong incubator](https://github.com/apache/incubator-inlong).
+
+## Build
+```
+mvn package -DskipTests -Pdocker -pl inlong-website
+```
+
+## Run
+```
+docker run -d --name website -e MANAGER_API_ADDRESS=127.0.0.1:8083 -p 80:80 inlong/website
+```
\ No newline at end of file
diff --git a/inlong-website/nginx.conf b/inlong-website/nginx.conf
new file mode 100644
index 0000000..98ebf86
--- /dev/null
+++ b/inlong-website/nginx.conf
@@ -0,0 +1,62 @@
+# 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.
+#
+
+user nginx;
+worker_processes auto;
+error_log /var/log/nginx/error.log;
+pid /run/nginx.pid;
+
+# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
+include /usr/share/nginx/modules/*.conf;
+
+events {
+    worker_connections 1024;
+}
+
+http {
+    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+                      '$status $body_bytes_sent "$http_referer" '
+                      '"$http_user_agent" "$http_x_forwarded_for"';
+
+    access_log  /var/log/nginx/access.log  main;
+
+    sendfile            on;
+    tcp_nopush          on;
+    tcp_nodelay         on;
+    keepalive_timeout   65;
+    types_hash_max_size 4096;
+
+    include             /etc/nginx/mime.types;
+    default_type        application/octet-stream;
+
+    # Load modular configuration files from the /etc/nginx/conf.d directory.
+    # See http://nginx.org/en/docs/ngx_core_module.html#include
+    # for more information.
+    include /etc/nginx/conf.d/*.conf;
+
+    server {
+        listen       80;
+        listen       [::]:80;
+        server_name  _;
+        root         /usr/share/nginx/html;
+
+        # Load configuration files for the default server block.
+        include /etc/nginx/default.d/*.conf;
+
+        location /api {
+        proxy_pass      http://manager_api_address;
+        }
+    }
+}
+
diff --git a/inlong-website/pom.xml b/inlong-website/pom.xml
index cca806a..de7a91d 100644
--- a/inlong-website/pom.xml
+++ b/inlong-website/pom.xml
@@ -69,4 +69,46 @@
             </plugin>
         </plugins>
     </build>
+
+    <profiles>
+        <profile>
+            <id>docker</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>com.spotify</groupId>
+                        <artifactId>dockerfile-maven-plugin</artifactId>
+                        <version>${dockerfile-maven.version}</version>
+                        <executions>
+                            <execution>
+                                <id>default</id>
+                                <goals>
+                                    <goal>build</goal>
+                                </goals>
+                            </execution>
+                            <execution>
+                                <id>tag-and-push-latest</id>
+                                <goals>
+                                    <goal>tag</goal>
+                                    <goal>push</goal>
+                                </goals>
+                                <configuration>
+                                    <repository>${docker.organization}/website</repository>
+                                    <tag>latest</tag>
+                                </configuration>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <repository>${docker.organization}/website</repository>
+                            <pullNewerImage>false</pullNewerImage>
+                            <tag>${project.version}</tag>
+                            <buildArgs>
+                                <WEBSITE_FILE>build</WEBSITE_FILE>
+                            </buildArgs>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
 </project>
\ No newline at end of file