Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc1785b5

Browse files
committed
first part of changes for OpenShift compatibility
1 parentffa595a commitc1785b5

File tree

4 files changed

+40
-21
lines changed

4 files changed

+40
-21
lines changed

‎deploy/docker/Dockerfile‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RUN chmod +x /lowcoder/api-service/*.sh
3232
## To create a separate image out of it, build it with:
3333
## DOCKER_BUILDKIT=1 docker build -f deploy/docker/Dockerfile -t lowcoderorg/lowcoder-ce-api-service --target lowcoder-ce-api-service .
3434
##
35-
FROM eclipse-temurin:17-jammyas lowcoder-ce-api-service
35+
FROM eclipse-temurin:17-jammyAS lowcoder-ce-api-service
3636
LABEL maintainer="lowcoder"
3737

3838
RUN apt-get update && apt-get install -y --no-install-recommends gosu \
@@ -51,7 +51,7 @@ CMD [ "sh" , "/lowcoder/api-service/entrypoint.sh" ]
5151
##
5252
## Build lowcoder node service
5353
##
54-
FROM ubuntu:jammyas build-node-service
54+
FROM ubuntu:jammyAS build-node-service
5555

5656
RUN apt update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y curl ca-certificates build-essential gnupg
5757

@@ -82,7 +82,7 @@ RUN chmod +x /lowcoder/node-service/*.sh
8282
## To create a separate image out of it, build it with:
8383
## DOCKER_BUILDKIT=1 docker build -f deploy/docker/Dockerfile -t lowcoderorg/lowcoder-ce-node-service --target lowcoder-ce-node-service .
8484
##
85-
FROM ubuntu:jammyas lowcoder-ce-node-service
85+
FROM ubuntu:jammyAS lowcoder-ce-node-service
8686
LABEL maintainer="lowcoder"
8787

8888
RUN apt update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y curl ca-certificates gnupg
@@ -133,7 +133,7 @@ RUN yarn build
133133
## To create a separate image out of it, build it with:
134134
## DOCKER_BUILDKIT=1 docker build -f deploy/docker/Dockerfile -t lowcoderorg/lowcoder-ce-frontend --target lowcoder-ce-frontend .
135135
##
136-
FROM nginx:1.25.1as lowcoder-ce-frontend
136+
FROM nginx:1.25.1AS lowcoder-ce-frontend
137137
LABEL maintainer="lowcoder"
138138

139139
# Change default nginx user into lowcoder user and remove default nginx config
@@ -198,7 +198,9 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-instal
198198
openjdk-17-jdk-headless \
199199
&& npm install -g yarn \
200200
&& rm -rf /var/cache/apt/lists \
201-
&& mkdir -p /lowcoder/assets
201+
&& mkdir -p /lowcoder/assets \
202+
&& apt-get clean \
203+
&& rm -rf /tmp/*
202204

203205
# Add lowcoder api-service
204206
COPY --chown=lowcoder:lowcoder --from=lowcoder-ce-api-service /lowcoder/api-service /lowcoder/api-service

‎deploy/docker/all-in-one/entrypoint.sh‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ export USER_ID=${LOWCODER_PUID:=9001}
66
export GROUP_ID=${LOWCODER_PGID:=9001}
77

88
# Update ID of lowcoder user if required
9-
if [!`id --user lowcoder`-eq${USER_ID} ];then
9+
if [!"$(id --user lowcoder)"-eq${USER_ID} ];then
1010
usermod --uid${USER_ID} lowcoder
1111
echo"ID for lowcoder user changed to:${USER_ID}"
1212
fi;
1313

1414
# Update ID of lowcoder group if required
15-
if [!`id --group lowcoder`-eq${GROUP_ID} ];then
15+
if [!"$(id --group lowcoder)"-eq${GROUP_ID} ];then
1616
groupmod --gid${GROUP_ID} lowcoder
1717
echo"ID for lowcoder group changed to:${GROUP_ID}"
1818
fi;
1919

2020
# Update host on which mongo is supposed to listen
21-
# If LOWCODER_MONGODB_EXPOSED is true, it willisten on all interfaces
21+
# If LOWCODER_MONGODB_EXPOSED is true, it willlisten on all interfaces
2222
if ["${LOWCODER_MONGODB_EXPOSED}"="true" ];then
2323
export MONGO_LISTEN_HOST="0.0.0.0"
2424
else
@@ -38,8 +38,10 @@ mkdir -p ${LOGS}/redis \
3838
${DATA}/mongodb \
3939
${CERT}
4040

41-
# Update owner of logs and data
42-
chown -R${USER_ID}:${GROUP_ID} /lowcoder-stacks/ /lowcoder/etc
41+
# Update owner of logs and data - do not try if not running as root (OpenShift)
42+
if ["$(id -u)"-eq 0 ];then
43+
chown -R"${USER_ID}:${GROUP_ID}" /lowcoder-stacks/ /lowcoder/etc
44+
fi
4345

4446
# Enable services
4547
SUPERVISOR_AVAILABLE="/lowcoder/etc/supervisord/conf-available"
@@ -73,8 +75,15 @@ fi;
7375

7476
# Enable frontend if configured to run
7577
if ["${LOWCODER_FRONTEND_ENABLED:=true}"="true" ];then
76-
ln${SUPERVISOR_AVAILABLE}/20-frontend.conf${SUPERVISOR_ENABLED}/20-frontend.conf
78+
ln${SUPERVISOR_AVAILABLE}/20-frontend.conf${SUPERVISOR_ENABLED}/20-frontend.conf
7779
fi;
7880

81+
# disable user directive if image is running non-root (Openshift)
82+
if ["$(id -u)"-ne 0 ];then
83+
foriin"${SUPERVISOR_ENABLED}"/*.conf;do
84+
sed -Ei's/^\s*user=.*$//'"$i"
85+
done
86+
fi
87+
7988
# Handle CMD command
8089
"$@"

‎deploy/docker/api-service/entrypoint.sh‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export GROUP_ID="${LOWCODER_PGID:=9001}"
99
echo"Initializing api-service..."
1010
/lowcoder/api-service/init.sh
1111

12-
if [-z$JAVA_HOME ];then
13-
JAVA_HOME=`dirname$(dirname$(readlink -f$(which javac)))`
12+
if [-z"$JAVA_HOME" ];then
13+
JAVA_HOME=$(dirname"$(dirname"$(readlink -f"$(which javac)")")")
1414
fi;
1515
APP_JAR="${APP_JAR:=/lowcoder/api-service/server.jar}"
1616
JAVA_OPTS="${JAVA_OPTS:=}"
@@ -19,15 +19,20 @@ CONTEXT_PATH=${CONTEXT_PATH:=/}
1919

2020
echo
2121
echo"Running lowcoder api-server with:"
22-
echo" user id:${USER_ID}"
23-
echo" group id:${GROUP_ID}"
2422
echo" base path:${CONTEXT_PATH}"
23+
24+
if ["$(id -u)"-eq 0 ];then
25+
# only use su if its possible, suppress for containers running non-root
26+
echo" user id:${USER_ID}"
27+
echo" group id:${GROUP_ID}"
28+
GOSU="gosu${USER_ID}:${GROUP_ID}"
29+
fi
2530
echo
26-
${JAVA_HOME}/bin/java -version
31+
"${JAVA_HOME}/bin/java" -version
2732
echo
2833

2934
cd /lowcoder/api-service
30-
execgosu${USER_ID}:${GROUP_ID}${JAVA_HOME}/bin/java \
35+
exec$GOSU"${JAVA_HOME}/bin/java" \
3136
-Djava.security.egd=file:/dev/./urandom \
3237
-Dhttps.protocols=TLSv1.1,TLSv1.2 \
3338
-Dlog4j2.formatMsgNoLookups=true \

‎deploy/docker/node-service/entrypoint.sh‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ cd /lowcoder/node-service/app
1515
echo
1616
echo"Running Lowcoder node-service with:"
1717
echo" API service host:${API_HOST}"
18-
echo" user id:${USER_ID}"
19-
echo" group id:${GROUP_ID}"
18+
if ["$(id -u)"-eq 0 ];then
19+
# only use su if its possible, suppress for containers running non-root
20+
echo" user id:${USER_ID}"
21+
echo" group id:${GROUP_ID}"
22+
GOSU="gosu${USER_ID}:${GROUP_ID}"
23+
fi
2024
echo
2125

22-
exec gosu${USER_ID}:${GROUP_ID} yarn start
23-
26+
exec$GOSU yarn start

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp