Skip to content

Commit

Permalink
Updated Docker Build Process (#17)
Browse files Browse the repository at this point in the history
* Updated the build process for the image.

* Added memory constraints since the build would fail on OOM.

* Updated compose file to specify image and platform.

* Additional notes from manually building parts of process.
  • Loading branch information
jyeary authored Feb 28, 2024
1 parent 45b295d commit 2839b6a
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 15 deletions.
22 changes: 22 additions & 0 deletions BUILD_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Manual Build Process

```
docker container run -it \
--platform linux/amd64 \
-e SDKMAN_DIR=/root/.sdkman \
-e GRAILS_VERSION=1.3.9 \
-p 8080:8080 \
-v ./openboxes-config.properties:/root/.grails/openboxes-config.properties \
-v ./openboxes-setenv.sh:/usr/share/tomcat7/bin/setenv.sh \
-v ./openboxes-run.sh:/root/openboxes-run.sh \
-v ./openboxes:/app \
azul/zulu-openjdk:7u352-7.56.0.11
```

```
docker run -d --name mysql-openboxes \
--platform linux/amd64 \
-e MYSQL_ROOT_PASSWORD=openboxes \
-p 3306:3306 \
mysql:5.7.44
```
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
version: "3"
services:
db:
image: mysql:5.7
image: mysql:5.7.44
platform: linux/amd64
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: openboxes
Expand All @@ -15,6 +16,7 @@ services:
grails:
build: ./grails-java7
command: sh /root/openboxes-run.sh
platform: linux/amd64
ports:
- "8080:8080"
volumes:
Expand Down
28 changes: 17 additions & 11 deletions grails-java7/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
FROM openjdk:7-jdk
FROM azul/zulu-openjdk:7u352-7.56.0.11

MAINTAINER Michael Seaton <[email protected]>
LABEL maintainer="Michael Seaton [email protected]"

# Environment variables

ENV SDKMAN_DIR /root/.sdkman
ENV GRAILS_VERSION 1.3.9
ENV NODE_VERSION=14.21.3

# Install Base Packages required and Node
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
RUN apt-get update && apt-get install -y curl zip python g++ make gcc build-essential \
&& curl -sL https://deb.nodesource.com/setup_13.x | bash - \
&& apt-get install -y nodejs \
&& curl -L https://www.npmjs.com/install.sh | sh

# Install Base Packages required
RUN apt-get update && apt-get install -y curl zip python2 g++ make gcc build-essential git

# Download node + extract
RUN curl -LO https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz &&\
tar -xvf node-v${NODE_VERSION}-linux-x64.tar.xz

# Update our PATH to include the node binary
ENV PATH=${PATH}:/node-v${NODE_VERSION}-linux-x64/bin

# Install Grails and Set Path
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
Expand All @@ -37,15 +42,16 @@ RUN bash -c "source $SDKMAN_DIR/bin/sdkman-init.sh && sdk install grails $GRAILS
RUN bash -c "source $SDKMAN_DIR/bin/sdkman-init.sh && sdk default grails $GRAILS_VERSION"

# set envs
ENV JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64
ENV JAVA_HOME /usr/lib/jvm/zulu7-ca-amd64
ENV GRAILS_HOME /root/.sdkman/candidates/grails/current
ENV PATH $GRAILS_HOME/bin:$PATH
ENV GRAILS_OPTS -XX:-UseSplitVerifier -Xverify:none
# Memory settings were required or else things would fail with OOM errors or stall forever
ENV GRAILS_OPTS -XX:MaxPermSize=8192m -Xmx8192M -XX:-UseSplitVerifier -Xverify:none

# Set the directory that an existing Grails app should be mounted into with a volume
RUN mkdir /app
WORKDIR /app

EXPOSE 8080

CMD ["grails"]
CMD ["grails"]
6 changes: 3 additions & 3 deletions openboxes-run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# grails doesn't run without it for some reason
export GRAILS_OPTS="-XX:-UseSplitVerifier -Xverify:none"
export GRAILS_OPTS="-XX:MaxPermSize=8192m -Xmx8192M -XX:-UseSplitVerifier -Xverify:none"

if [ ! -f /app/web-app/WEB-INF/applicationContext.xml ]; then
echo "Forcing grails upgrade"
Expand All @@ -16,8 +16,8 @@ npm config set engine-strict true
# npm update

# some dependencies don't get resolved on thier own
npm i --no-package-lock --legacy-peer-deps --force --verbose --stacktrace
npm i --no-package-lock --legacy-peer-deps --force --verbose --stacktrace --unsafe-perm
grails run-app --stacktrace

# if you want to compile enable this and stop grails run-app
# grails -Dgrails.env=staging war
# grails -Dgrails.env=staging war

0 comments on commit 2839b6a

Please sign in to comment.