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

Use a Tomcat image to run OpenBoxes release WAR #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 1 addition & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,14 @@ services:
MYSQL_PASSWORD: openboxes
volumes:
- ./openboxes-mysql.cnf:/etc/mysql/conf.d/openboxes-mysql.cnf
- ./db/mysql:/var/lib/mysql
ports:
- "3306:3306"

grails:
build: ./grails-java7
command: sh /root/openboxes-run.sh
platform: linux/amd64
ports:
- "8080:8080"
volumes:
- ./openboxes-config.properties:/root/.grails/openboxes-config.properties
- ./openboxes-setenv.sh:/usr/share/tomcat7/bin/setenv.sh
- ./openboxes-run.sh:/root/openboxes-run.sh
- ../openboxes:/app
depends_on:
- db
71 changes: 25 additions & 46 deletions grails-java7/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,57 +1,36 @@
FROM azul/zulu-openjdk:7u352-7.56.0.11
FROM tomcat:7-jre7-alpine

LABEL maintainer="Michael Seaton [email protected]"
ARG OPENBOXES_VERSION="v0.8.23-hotfix1"
ARG DB_HOST=db
ARG DB_USER=openboxes
ARG DB_PASS=openboxes
ARG DB_NAME=openboxes

# Environment variables
ARG APP_URL=http://localhost:8080

ENV SDKMAN_DIR /root/.sdkman
ENV GRAILS_VERSION 1.3.9
ENV NODE_VERSION=14.21.3
RUN apk add --no-cache curl

RUN curl -Lv https://github.com/openboxes/openboxes/releases/download/${OPENBOXES_VERSION}/openboxes.war -o /usr/local/tomcat/webapps/openboxes.war

# Install Base Packages required
RUN apt-get update && apt-get install -y curl zip python2 g++ make gcc build-essential git
COPY <<EOF /root/.grails/openboxes-config.properties
# Database connection settings
dataSource.url=jdbc:mysql://${DB_HOST}:3306/${DB_NAME}?autoReconnect=true&zeroDateTimeBehavior=convertToNull&verifyServerCertificate=false
dataSource.username=${DB_USER}
dataSource.password=${DB_PASS}

# 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
# OpenBoxes mail settings - disabled by default
grails.mail.enabled=false

# Update our PATH to include the node binary
ENV PATH=${PATH}:/node-v${NODE_VERSION}-linux-x64/bin
# if test fail this must be enabled
openboxes.fixtures.enabled=false

# Install Grails and Set Path
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN curl -s "https://get.sdkman.io" | bash
RUN chmod a+x "$SDKMAN_DIR/bin/sdkman-init.sh"
# enable custom locale
openboxes.locale.custom.enabled = true

# change timeout and max time based on your liking and internet speed
RUN set -x \
&& echo "sdkman_auto_answer=true" > $SDKMAN_DIR/etc/config \
&& echo "sdkman_auto_selfupdate=false" >> $SDKMAN_DIR/etc/config \
&& echo "sdkman_curl_connect_timeout=20" >> $SDKMAN_DIR/etc/config \
&& echo "sdkman_curl_max_time=0" >> $SDKMAN_DIR/etc/config \
&& echo "sdkman_insecure_ssl=false" >> $SDKMAN_DIR/etc/config
# in beta
# openboxes.scannerDetection.enabled = true

WORKDIR $SDKMAN_DIR
RUN [[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh" && exec "$@"
# Default server URL
grails.serverURL=${APP_URL}
EOF

RUN source /root/.bashrc

# install and set grails version
RUN bash -c "source $SDKMAN_DIR/bin/sdkman-init.sh && sdk install grails $GRAILS_VERSION"
RUN bash -c "source $SDKMAN_DIR/bin/sdkman-init.sh && sdk default grails $GRAILS_VERSION"

# set envs
ENV JAVA_HOME /usr/lib/jvm/zulu7-ca-amd64
ENV GRAILS_HOME /root/.sdkman/candidates/grails/current
ENV PATH $GRAILS_HOME/bin:$PATH
# 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"]