Skip to content

Commit

Permalink
Use a container volume and increase memory limit
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoelg committed Sep 13, 2024
1 parent e6edaaf commit 68b10e8
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ USER kogito

COPY --chown=kogito:root dist-dev/quarkus-app/ /home/kogito/serverless-logic-web-tools-swf-deployment-quarkus-app/
COPY --chown=kogito:root dist-dev/settings.xml /home/kogito/.m2/settings.xml
COPY --chown=kogito:root entrypoint.sh /home/kogito/entrypoint.sh

WORKDIR /home/kogito/serverless-logic-web-tools-swf-deployment-quarkus-app/

Expand All @@ -41,14 +42,9 @@ RUN rm -rf src/test/ && \
-Dquarkus-profiles=build,dev

USER root
RUN chmod -R 775 /home/kogito
RUN chmod -R 775 /home/kogito && mkdir -p -m 777 /tmp/app
USER kogito

ENTRYPOINT mvn quarkus:dev \
quarkus:go-offline \
-nsu \
-o \
-s /home/kogito/.m2/settings.xml \
-Ddebug=false \
-Dmaven.repo.local=/home/kogito/.m2/repository \
-Dquarkus.http.port=8080
EXPOSE 8080

ENTRYPOINT [ "/home/kogito/entrypoint.sh" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
#
# 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.
#

# Copying the assets here is essential for when the container is running with the readOnlyRootFilesystem flag.
# But, just like any other directory modified during runtime, the /tmp/app must be a mounted volume in the container in this case.
cp -R /home/kogito/* /tmp/app

cd /tmp/app/serverless-logic-web-tools-swf-deployment-quarkus-app

mvn quarkus:dev \
-nsu \
-o \
-s /home/kogito/.m2/settings.xml \
-Ddebug=false \
-Dmaven.repo.local=/home/kogito/.m2/repository \
-Dquarkus.http.port=8080
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ export class SpinUpDevModePipeline extends OpenShiftPipeline<SpinUpDevModePipeli
},
},
spec: {
volumes: [
{
name: `${resourceArgs.resourceName}-volume`,
emptyDir: {},
},
],
containers: [
{
name: resourceArgs.resourceName,
Expand All @@ -207,6 +213,17 @@ export class SpinUpDevModePipeline extends OpenShiftPipeline<SpinUpDevModePipeli
protocol: "TCP",
},
],
resources: {
limits: {
memory: "4096Mi",
},
},
volumeMounts: [
{
mountPath: "/tmp/app",
name: `${resourceArgs.resourceName}-volume`,
},
],
env: [
{ name: DeployConstants.KOGITO_DATA_INDEX_URL_KEY, value: routeUrl },
{ name: DeployConstants.KOGITO_DEV_UI_URL_KEY, value: routeUrl },
Expand Down

0 comments on commit 68b10e8

Please sign in to comment.