Skip to content

Commit b22859f

Browse files
committed
new: serve lowcoder-sdk and lowcoder-comps
1 parent b00194d commit b22859f

File tree

5 files changed

+76
-71
lines changed

5 files changed

+76
-71
lines changed

deploy/docker/Dockerfile

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,31 @@ CMD [ "/bin/sh", "/lowcoder/node-service/entrypoint.sh" ]
109109
## Build lowcoder client application
110110
##
111111
FROM node:20.2-slim AS build-client
112-
COPY ./client /lowcoder-client
113-
WORKDIR /lowcoder-client
114-
RUN yarn --immutable
115-
116-
# TODO: build lowcoder-comps
117112

118113
# curl is required for yarn build to succeed, because it calls it while building client
119114
RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates
120115

116+
# Build client
117+
COPY ./client /lowcoder-client
118+
WORKDIR /lowcoder-client
119+
RUN yarn --immutable
120+
121121
ARG REACT_APP_COMMIT_ID=test
122122
ARG REACT_APP_ENV=production
123123
ARG REACT_APP_EDITION=community
124124
ARG REACT_APP_DISABLE_JS_SANDBOX=true
125125
RUN yarn build
126126

127+
# Build lowcoder-comps
128+
WORKDIR /lowcoder-client/packages/lowcoder-comps
129+
RUN yarn install
130+
RUN yarn build
131+
RUN tar -zxf lowcoder-comps-*.tgz && mv package lowcoder-comps
132+
133+
# Build lowcoder-sdk
134+
WORKDIR /lowcoder-client/packages/lowcoder-sdk
135+
RUN yarn install
136+
RUN yarn build
127137

128138
##
129139
## Intermediary Lowcoder client image
@@ -140,8 +150,13 @@ RUN usermod --login lowcoder --uid 9001 nginx \
140150
&& rm -f /etc/nginx/nginx.conf \
141151
&& mkdir -p /lowcoder/assets
142152

143-
# Copy lowcoder client data
153+
# Copy lowcoder client
144154
COPY --chown=lowcoder:lowcoder --from=build-client /lowcoder-client/packages/lowcoder/build/ /lowcoder/client
155+
# Copy lowcoder components
156+
COPY --chown=lowcoder:lowcoder --from=build-client /lowcoder-client/packages/lowcoder-comps/lowcoder-comps /lowcoder/client-comps
157+
# Copy lowcoder SDK
158+
COPY --chown=lowcoder:lowcoder --from=build-client /lowcoder-client/packages/lowcoder-sdk /lowcoder/client-sdk
159+
145160

146161
# Copy additional nginx init scripts
147162
COPY deploy/docker/frontend/00-change-nginx-user.sh /docker-entrypoint.d/00-change-nginx-user.sh
@@ -150,6 +165,7 @@ COPY deploy/docker/frontend/01-update-nginx-conf.sh /docker-entrypoint.d/01-upda
150165
RUN chmod +x /docker-entrypoint.d/00-change-nginx-user.sh && \
151166
chmod +x /docker-entrypoint.d/01-update-nginx-conf.sh
152167

168+
COPY deploy/docker/frontend/server.conf /etc/nginx/server.conf
153169
COPY deploy/docker/frontend/nginx-http.conf /etc/nginx/nginx-http.conf
154170
COPY deploy/docker/frontend/nginx-https.conf /etc/nginx/nginx-https.conf
155171
COPY deploy/docker/frontend/ssl-certificate.conf /etc/nginx/ssl-certificate.conf

deploy/docker/frontend/01-update-nginx-conf.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ else
1818
ln -s /etc/nginx/nginx-http.conf /etc/nginx/nginx.conf
1919
fi;
2020

21-
sed -i "s@__LOWCODER_MAX_QUERY_TIMEOUT__@${LOWCODER_MAX_QUERY_TIMEOUT:=120}@" /etc/nginx/nginx.conf
2221
sed -i "s@__LOWCODER_MAX_REQUEST_SIZE__@${LOWCODER_MAX_REQUEST_SIZE:=20m}@" /etc/nginx/nginx.conf
23-
sed -i "s@__LOWCODER_API_SERVICE_URL__@${LOWCODER_API_SERVICE_URL:=http://localhost:8080}@" /etc/nginx/nginx.conf
24-
sed -i "s@__LOWCODER_NODE_SERVICE_URL__@${LOWCODER_NODE_SERVICE_URL:=http://localhost:6060}@" /etc/nginx/nginx.conf
22+
sed -i "s@__LOWCODER_MAX_QUERY_TIMEOUT__@${LOWCODER_MAX_QUERY_TIMEOUT:=120}@" /etc/nginx/server.conf
23+
sed -i "s@__LOWCODER_API_SERVICE_URL__@${LOWCODER_API_SERVICE_URL:=http://localhost:8080}@" /etc/nginx/server.conf
24+
sed -i "s@__LOWCODER_NODE_SERVICE_URL__@${LOWCODER_NODE_SERVICE_URL:=http://localhost:6060}@" /etc/nginx/server.conf
2525

2626
echo "nginx config updated with:"
2727
echo " Lowcoder max upload size: ${LOWCODER_MAX_REQUEST_SIZE:=20m}"

deploy/docker/frontend/nginx-http.conf

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,37 +33,7 @@ http {
3333

3434
server {
3535
listen 3000 default_server;
36-
root /lowcoder/client;
3736

38-
proxy_connect_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
39-
proxy_send_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
40-
proxy_read_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
41-
42-
location / {
43-
try_files $uri /index.html;
44-
45-
if ($request_filename ~* .*.(html|htm)$) {
46-
add_header Cache-Control no-cache;
47-
}
48-
}
49-
50-
location /assets {
51-
alias /lowcoder/assets;
52-
expires 1M;
53-
}
54-
55-
location /api {
56-
proxy_set_header X-Forwarded-Proto $scheme;
57-
proxy_set_header X-Forwarded-Host $host;
58-
proxy_set_header X-Real-IP $remote_addr;
59-
proxy_pass __LOWCODER_API_SERVICE_URL__;
60-
}
61-
62-
location /node-service/plugin-icons {
63-
proxy_set_header X-Forwarded-Proto $scheme;
64-
proxy_set_header X-Forwarded-Host $host;
65-
proxy_set_header X-Real-IP $remote_addr;
66-
proxy_pass __LOWCODER_NODE_SERVICE_URL__;
67-
}
37+
include /etc/nginx/server.conf;
6838
}
6939
}

deploy/docker/frontend/nginx-https.conf

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,41 +33,11 @@ http {
3333

3434
server {
3535
listen 3443 ssl;
36-
root /lowcoder/client;
3736

3837
include /etc/nginx/ssl-certificate.conf;
3938
include /etc/nginx/ssl-params.conf;
4039

41-
proxy_connect_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
42-
proxy_send_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
43-
proxy_read_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
44-
45-
location / {
46-
try_files $uri /index.html;
47-
48-
if ($request_filename ~* .*.(html|htm)$) {
49-
add_header Cache-Control no-cache;
50-
}
51-
}
52-
53-
location /assets {
54-
alias /lowcoder/assets;
55-
expires 1M;
56-
}
57-
58-
location /api {
59-
proxy_set_header X-Forwarded-Proto $scheme;
60-
proxy_set_header X-Forwarded-Host $host;
61-
proxy_set_header X-Real-IP $remote_addr;
62-
proxy_pass __LOWCODER_API_SERVICE_URL__;
63-
}
64-
65-
location /node-service/plugin-icons {
66-
proxy_set_header X-Forwarded-Proto $scheme;
67-
proxy_set_header X-Forwarded-Host $host;
68-
proxy_set_header X-Real-IP $remote_addr;
69-
proxy_pass __LOWCODER_NODE_SERVICE_URL__;
70-
}
40+
include /etc/nginx/server.conf;
7141
}
7242

7343
}

deploy/docker/frontend/server.conf

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
root /lowcoder/client;
2+
3+
proxy_connect_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
4+
proxy_send_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
5+
proxy_read_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
6+
7+
location / {
8+
try_files $uri /index.html;
9+
10+
if ($request_filename ~* .*.(html|htm)$) {
11+
add_header Cache-Control no-cache;
12+
}
13+
}
14+
15+
location /sdk {
16+
try_files $uri =404;
17+
18+
alias /lowcoder/client-sdk;
19+
expires 1M;
20+
}
21+
22+
location /comps {
23+
try_files $uri =404;
24+
25+
alias /lowcoder/client-comps;
26+
expires 1M;
27+
}
28+
29+
location /assets {
30+
try_files $uri =404;
31+
32+
alias /lowcoder/assets;
33+
expires 1M;
34+
}
35+
36+
location /api {
37+
proxy_set_header X-Forwarded-Proto $scheme;
38+
proxy_set_header X-Forwarded-Host $host;
39+
proxy_set_header X-Real-IP $remote_addr;
40+
proxy_pass __LOWCODER_API_SERVICE_URL__;
41+
}
42+
43+
location /node-service/plugin-icons {
44+
proxy_set_header X-Forwarded-Proto $scheme;
45+
proxy_set_header X-Forwarded-Host $host;
46+
proxy_set_header X-Real-IP $remote_addr;
47+
proxy_pass __LOWCODER_NODE_SERVICE_URL__;
48+
}
49+

0 commit comments

Comments
 (0)