Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker build update #574

Merged
merged 3 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions deploy/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
##
## Create custom JRE for running Lowcoder server application
##
FROM eclipse-temurin:17-jdk-jammy AS jre-build
RUN jlink --add-modules java.base,java.compiler,java.datatransfer,java.desktop,java.instrument,java.logging,java.management,java.management.rmi,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.se,java.security.jgss,java.security.sasl,java.smartcardio,java.sql,java.sql.rowset,java.transaction.xa,java.xml,java.xml.crypto,jdk.accessibility,jdk.charsets,jdk.crypto.cryptoki,jdk.crypto.ec,jdk.dynalink,jdk.httpserver,jdk.incubator.foreign,jdk.incubator.vector,jdk.internal.vm.ci,jdk.jdwp.agent,jdk.jfr,jdk.jsobject,jdk.localedata,jdk.management,jdk.management.agent,jdk.management.jfr,jdk.naming.dns,jdk.naming.rmi,jdk.net,jdk.nio.mapmode,jdk.sctp,jdk.security.auth,jdk.security.jgss,jdk.unsupported,jdk.xml.dom,jdk.zipfs,jdk.attach \
--output /build/jre \
--no-man-pages \
--no-header-files \
--compress=2

##
## Build Lowcoder api-service application
##
Expand All @@ -23,9 +13,6 @@ RUN mkdir -p /lowcoder/api-service/plugins /lowcoder/api-service/config /lowcode
ARG JAR_FILE=/lowcoder-server/lowcoder-server/target/lowcoder-server-*.jar
ARG PLUGIN_JARS=/lowcoder-server/lowcoder-plugins/*/target/*.jar

# Copy Java runtime for running server
COPY --from=jre-build /build/jre /lowcoder/api-service/jre

# Copy lowcoder server application and plugins
RUN cp ${JAR_FILE} /lowcoder/api-service/server.jar \
&& cp ${PLUGIN_JARS} /lowcoder/api-service/plugins/
Expand All @@ -45,7 +32,7 @@ RUN chmod +x /lowcoder/api-service/*.sh
## To create a separate image out of it, build it with:
## DOCKER_BUILDKIT=1 docker build -f deploy/docker/Dockerfile -t lowcoderorg/lowcoder-ce-api-service --target lowcoder-ce-api-service .
##
FROM ubuntu:jammy as lowcoder-ce-api-service
FROM eclipse-temurin:17-jammy as lowcoder-ce-api-service
LABEL maintainer="lowcoder"

RUN apt-get update && apt-get install -y --no-install-recommends gosu \
Expand Down Expand Up @@ -152,7 +139,8 @@ LABEL maintainer="lowcoder"
# Change default nginx user into lowcoder user and remove default nginx config
RUN usermod --login lowcoder --uid 9001 nginx \
&& groupmod --new-name lowcoder --gid 9001 nginx \
&& rm -f /etc/nginx/nginx.conf
&& rm -f /etc/nginx/nginx.conf \
&& mkdir -p /lowcoder/assets

# Copy lowcoder client data
COPY --chown=lowcoder:lowcoder --from=build-client /lowcoder-client/packages/lowcoder/build/ /lowcoder/client
Expand Down Expand Up @@ -207,8 +195,10 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-instal
supervisor \
gosu \
nodejs \
openjdk-17-jdk-headless \
&& npm install -g yarn \
&& rm -rf /var/cache/apt/lists
&& rm -rf /var/cache/apt/lists \
&& mkdir -p /lowcoder/assets

# Add lowcoder api-service
COPY --chown=lowcoder:lowcoder --from=lowcoder-ce-api-service /lowcoder/api-service /lowcoder/api-service
Expand Down
4 changes: 3 additions & 1 deletion deploy/docker/api-service/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ export GROUP_ID="${PGID:=9001}"
echo "Initializing api-service..."
/lowcoder/api-service/init.sh

if [ -z $JAVA_HOME ]; then
JAVA_HOME=`dirname $(dirname $(readlink -f $(which javac)))`
fi;
APP_JAR="${APP_JAR:=/lowcoder/api-service/server.jar}"
JAVA_HOME=/lowcoder/api-service/jre
JAVA_OPTS="${JAVA_OPTS:=}"
CUSTOM_APP_PROPERTIES="${APP_PROPERTIES}"
CONTEXT_PATH=${CONTEXT_PATH:=/}
Expand Down
5 changes: 4 additions & 1 deletion deploy/docker/docker-compose-multi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
MONGO_INITDB_ROOT_PASSWORD: secret123
# Uncomment to save database data into local 'mongodata' folder
# volumes:
# - ./mogodata:/data/db
# - ./mongodata:/data/db
restart: unless-stopped

redis:
Expand Down Expand Up @@ -95,4 +95,7 @@ services:
depends_on:
- lowcoder-node-service
- lowcoder-api-service
# Uncomment to serve local files as static assets
# volumes:
# - ./static-assets:/lowcoder/assets

1 change: 1 addition & 0 deletions deploy/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ services:
LOWCODER_MAX_QUERY_TIMEOUT: 120
volumes:
- ./lowcoder-stacks:/lowcoder-stacks
- ./lowcoder-stacks/assets:/lowcoder/assets
restart: unless-stopped

5 changes: 5 additions & 0 deletions deploy/docker/frontend/nginx-http.conf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ http {
}
}

location /assets {
alias /lowcoder/assets;
expires 1M;
}

location /api {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
Expand Down
6 changes: 6 additions & 0 deletions deploy/docker/frontend/nginx-https.conf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ http {
}
}

location /assets {
root /lowcoder/assets;
alias /lowcoder/assets;
expires 1M;
}

location /api {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
Expand Down
Loading