1. 修改dockerfile

2. 删除无用配置文件
This commit is contained in:
_haoqi
2022-09-16 15:13:18 +08:00
parent 0d9a6702c1
commit 227479f695
6 changed files with 119 additions and 73 deletions

View File

@@ -3,7 +3,7 @@ version: "3"
services:
knowstreaming-manager:
image: ks_manage:1.0
image: km_manage:1.1
container_name: knowstreaming-manager
privileged: true
restart: always
@@ -32,7 +32,7 @@ services:
# volumes:
# - /Users/haoqi/Downloads/ks/manage/log:/logs
knowstreaming-ui:
image: ks_ui:1.0
image: km:1.0
container_name: knowstreaming-ui
restart: always
ports:

View File

@@ -1,9 +1,7 @@
FROM debian:stable-20220912-slim
FROM centos:7.9.2009
LABEL org.opencontainers.image.authors="haoqi123"
ENV INIT_ES_FILE=./init/*
ARG INIT_ES_FILE=./init/*
COPY ${INIT_ES_FILE} /
ENV TZ=Asia/Shanghai
RUN apt-get update \
&& apt-get install -y curl
ENTRYPOINT ["/bin/bash","/template.sh","start"]
ENTRYPOINT ["/bin/sh","/template.sh","start"]

View File

@@ -1,14 +1,36 @@
FROM amd64/openjdk:17.0.2
FROM docker.io/amd64/eclipse-temurin:17.0.4.1_1-jdk-centos7
LABEL org.opencontainers.image.authors="haoqi123"
LABEL maintainer="haoqi123 <1148648445@qq.com>"
EXPOSE 80
WORKDIR /knowstreaming
ARG VERSION_MAVEN=3.6.3
ARG VERSION_KM=v3.0.0-beta.2
ARG INIT_FILE=./init/*
ARG CONFIG_FILE=./conf/*
ENV JAR_FILE=./jar/*.jar
ENV INIT_FILE=./init/*
ENV CONFIG_FILE=./conf/*
COPY ${JAR_FILE} /app/app.jar
COPY ${INIT_FILE} /
COPY ${CONFIG_FILE} /conf/
ENTRYPOINT ["/bin/bash","/start.sh"]
# SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN yum install -y git
RUN curl -fsSLO --compressed "https://dlcdn.apache.org/maven/maven-3/${VERSION_MAVEN}/binaries/apache-maven-${VERSION_MAVEN}-bin.tar.gz" \
&& mkdir maven/ \
&& tar -zxf "apache-maven-${VERSION_MAVEN}-bin.tar.gz" -C maven/ --strip-components=1 --no-same-owner \
&& rm -rf /knowstreaming/*.tar.gz \
&& ln -s /knowstreaming/maven/bin/mvn /usr/local/bin/mvn \
# && curl -fsSLO --compressed https://github.com/didi/KnowStreaming/archive/refs/tags/${VERSION_KM}.zip \
&& git clone https://github.com/didi/KnowStreaming.git \
# && unzip -o -q master.zip \
&& cd KnowStreaming && git checkout ${VERSION_KM} \
&& sed -i "/km-console/d" ./pom.xml \
&& mvn -U clean package -Dmaven.test.skip=true \
&& cd / \
&& mv /knowstreaming/KnowStreaming/km-rest/target/ks-km.jar /app/app.jar \
&& rm -rf /knowstreaming/* /usr/local/bin/mvn \
&& yum erase -y git && yum clean all \
&& rm -rf `pwd`/.m2 /tmp/*
ENTRYPOINT ["/bin/bash","/start.sh"]

View File

@@ -4,7 +4,7 @@ LABEL org.opencontainers.image.authors="haoqi123"
EXPOSE 3306
ENV INIT_SOURCE_FILE=./sql/*.sql
ENV MYSQL_CNF_FILE=./conf/*.cnf
ARG INIT_SOURCE_FILE=./sql/*.sql
ARG MYSQL_CNF_FILE=./conf/*.cnf
COPY ${INIT_SOURCE_FILE} /docker-entrypoint-initdb.d/
COPY ${MYSQL_CNF_FILE} /etc/mysql/conf.d/

View File

@@ -1,14 +1,86 @@
FROM docker.io/library/nginx:1.23.1
FROM docker.io/amd64/nginx:1.22
LABEL org.opencontainers.image.authors="haoqi123"
LABEL maintainer="haoqi123 <1148648445@qq.com>"
WORKDIR /pub
EXPOSE 80
WORKDIR /knowstreaming
ENV HTML_FILE=./pub
ENV NGINX_CONF=./conf/*.conf
ARG VERSION_NODE=v14.20.0
ARG VERSION_KM=v3.0.0-beta.2
COPY ${NGINX_CONF} /etc/nginx/conf.d/default.conf
COPY ${HTML_FILE} /pub
# SHELL ["/bin/bash", "-o", "pipefail", "-c"]
HEALTHCHECK --interval=60s --timeout=60s CMD curl -f http://localhost/ks-km/api/v3/open/health || exit 1
RUN apt update \
&& apt install -y git unzip
RUN echo 'server { \
listen 80; \
server_name localhost; \
gzip on; \
gzip_buffers 16 8k; \
gzip_comp_level 4; \
gzip_http_version 1.0; \
gzip_min_length 1280; \
gzip_types text/plain text/css text/xml application/x-javascript application/xml application/xml+rss application/json application/javascript text/*; \
gzip_vary on; \
root /pub; \
location / { \
root /pub; \
if ($request_filename ~* .*\.(?:htm|html|json)$) { \
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate"; \
} \
try_files $uri /layout/index.html; \
} \
location ~* \.(json)$ { \
add_header Cache-Control no-cache; \
} \
location @kmfallback { \
} \
#location ~ ^/(clusters|config|cluster|login) { \
# rewrite ^.*$ /; \
#} \
location ~ ^/ks-km/api/v3 { \
#rewrite ^/ks-km/api/v3/(.*)$ /ks-km/ks-km/api/v3/$1 break; \
proxy_pass http://knowstreaming-manager; \
#proxy_pass https://api-kylin-xg02.intra.xiaojukeji.com; \
#proxy_cookie_path /ks-km/ /; \
#proxy_set_header Host $host; \
#proxy_set_header Referer $http_referer; \
#proxy_set_header Cookie $http_cookie; \
#proxy_set_header X-Real-Ip $remote_addr; \
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; \
} \
location ~ ^/logi-security/api/v1 { \
#rewrite ^/logi-security/api/v1/(.*)$ /ks-km/logi-security/api/v1/$1 break; \
proxy_pass http://knowstreaming-manager; \
#proxy_pass https://api-kylin-xg02.intra.xiaojukeji.com; \
} \
location ~ ^/(401|403|404|500){ \
rewrite ^.*$ /; \
} \
}' > /etc/nginx/conf.d/default.conf
RUN curl -fsSLO --compressed "https://npm.taobao.org/mirrors/node/${VERSION_NODE}/node-${VERSION_NODE}-linux-x64.tar.gz" \
&& mkdir node/ \
&& tar -zxf "node-${VERSION_NODE}-linux-x64.tar.gz" -C node/ --strip-components=1 --no-same-owner \
&& rm -rf /knowstreaming/*.tar.gz \
&& ln -s /knowstreaming/node/bin/node /usr/local/bin/node \
&& ln -s /knowstreaming/node/bin/npm /usr/local/bin/npm \
&& npm config set strict-ssl false \
&& npm config set registry https://registry.npm.taobao.org \
&& npm info underscore \
&& node --version \
&& npm --version \
&& curl -fsSLO --compressed https://github.com/didi/KnowStreaming/archive/refs/tags/${VERSION_KM}.zip \
&& unzip -o -q master.zip \
&& cd KnowStreaming-master/km-console \
&& npm install -g lerna && npm run i && npm run build \
&& mv /knowstreaming/KnowStreaming-master/km-rest/src/main/resources/templates /pub \
&& npm uninstall -g lerna \
&& cd / \
&& rm -rf /knowstreaming/* /usr/local/bin/node /usr/local/bin/npm \
&& apt remove -y git unzip && apt autoremove -y && apt remove --purge --auto-remove -y \
&& rm -rf /var/lib/apt/lists/* /tmp /root/.npm
#ENTRYPOINT ["ls", "/ks_ui/km-console"]
#CMD ["nginx", "-g", "daemon off;"]

View File

@@ -1,46 +0,0 @@
server {
listen 80;
server_name localhost;
gzip on;
gzip_buffers 16 8k;
gzip_comp_level 4;
gzip_http_version 1.0;
gzip_min_length 1280;
gzip_types text/plain text/css text/xml application/x-javascript application/xml application/xml+rss application/json application/javascript text/*;
gzip_vary on;
root /pub;
location / {
root /pub;
if ($request_filename ~* .*\.(?:htm|html|json)$) {
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
}
try_files $uri /layout/index.html;
}
location ~* \.(json)$ {
add_header Cache-Control no-cache;
}
location @kmfallback {
}
#location ~ ^/(clusters|config|cluster|login) {
# rewrite ^.*$ /;
#}
location ~ ^/ks-km/api/v3 {
#rewrite ^/ks-km/api/v3/(.*)$ /ks-km/ks-km/api/v3/$1 break;
proxy_pass http://knowstreaming-manager;
#proxy_pass https://api-kylin-xg02.intra.xiaojukeji.com;
#proxy_cookie_path /ks-km/ /;
#proxy_set_header Host $host;
#proxy_set_header Referer $http_referer;
#proxy_set_header Cookie $http_cookie;
#proxy_set_header X-Real-Ip $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~ ^/logi-security/api/v1 {
#rewrite ^/logi-security/api/v1/(.*)$ /ks-km/logi-security/api/v1/$1 break;
proxy_pass http://knowstreaming-manager;
#proxy_pass https://api-kylin-xg02.intra.xiaojukeji.com;
}
location ~ ^/(401|403|404|500){
rewrite ^.*$ /;
}
}