forked from havochvatten/MSP-Symphony
-
Notifications
You must be signed in to change notification settings - Fork 0
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
wip! feat(symphony-ws): Add Dockerfile #1
Open
zapling
wants to merge
2
commits into
develop
Choose a base branch
from
feat/symphony-ws-dockerfile
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
FROM maven:3.9.6-eclipse-temurin-17 as build | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN mvn package -DskipTests | ||
|
||
# Based on https://github.com/tonda100/wildfly-postgresql | ||
FROM quay.io/wildfly/wildfly:26.1.2.Final-jdk17 as production | ||
|
||
ENV WILDFLY_HOME /opt/jboss/wildfly | ||
|
||
ENV DATASOURCE_NAME ApplicationDS | ||
ENV DATASOURCE_JNDI java:/SymphonyDS | ||
|
||
ENV DB_HOST database | ||
ENV DB_PORT 5432 | ||
ENV DB_USER user | ||
ENV DB_PASS password | ||
ENV DB_NAME symphony | ||
|
||
# create temporary deployment dir, because wars can deploy after the datasource is created | ||
USER jboss | ||
RUN mkdir /tmp/deployments | ||
ENV DEPLOY_DIR /tmp/deployments | ||
|
||
RUN mkdir /tmp/jboss-cli | ||
ENV CLI_DIR /tmp/jboss-cli | ||
|
||
COPY startWithPostgres.sh $WILDFLY_HOME/bin | ||
|
||
USER root | ||
RUN chown jboss:jboss $WILDFLY_HOME/bin/startWithPostgres.sh | ||
# RUN chown -R jboss:jboss $CLI_DIR | ||
RUN chmod 755 $WILDFLY_HOME/bin/startWithPostgres.sh | ||
USER jboss | ||
|
||
RUN wget -O /tmp/postgresql-42.2.28.jar https://jdbc.postgresql.org/download/postgresql-42.2.28.jre7.jar | ||
|
||
COPY --from=build /app/target/symphony-ws-1.19.0-SNAPSHOT.war /tmp/deployments/ | ||
|
||
ENTRYPOINT $WILDFLY_HOME/bin/startWithPostgres.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash | ||
zapling marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
set -e # Exit the script on error | ||
|
||
if [[ -f wildfly/wildfly.started ]]; then | ||
echo "=> Wildfly has already been started" | ||
exit 1 | ||
fi | ||
|
||
JBOSS_CLI=$WILDFLY_HOME/bin/jboss-cli.sh | ||
|
||
function wait_for_server() { | ||
until `$JBOSS_CLI -c "ls /deployment" &> /dev/null`; do | ||
echo "Waiting" | ||
sleep 1 | ||
done | ||
} | ||
|
||
echo "=> Starting WildFly server" | ||
$WILDFLY_HOME/bin/standalone.sh -b=0.0.0.0 -c standalone.xml > /dev/null & | ||
|
||
echo "=> Waiting for the server to boot" | ||
wait_for_server | ||
|
||
echo "=> Setup Datasource" | ||
$JBOSS_CLI -c << EOF | ||
batch | ||
|
||
# Add PostgreSQL driver | ||
module add --name=org.postgres --resources=/tmp/postgresql-42.2.28.jar --dependencies=javax.api,javax.transaction.api | ||
/subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgres",driver-class-name=org.postgresql.Driver) | ||
|
||
# Add the datasource | ||
data-source add \ | ||
--jndi-name=$DATASOURCE_JNDI \ | ||
--name=$DATASOURCE_NAME \ | ||
--connection-url=jdbc:postgresql://$DB_HOST:$DB_PORT/$DB_NAME \ | ||
--driver-name=postgres \ | ||
--user-name=$DB_USER \ | ||
--password=$DB_PASS \ | ||
--check-valid-connection-sql="SELECT 1" \ | ||
--background-validation=true \ | ||
--background-validation-millis=60000 \ | ||
--flush-strategy=IdleConnections \ | ||
--min-pool-size=10 --max-pool-size=100 --pool-prefill=false | ||
|
||
# Execute the batch | ||
run-batch | ||
EOF | ||
|
||
FILES=$(find "$CLI_DIR" -iname '*.cli') | ||
for f in $FILES | ||
do | ||
echo "Processing $f file..." | ||
$JBOSS_CLI -c --file=$f | ||
done | ||
|
||
echo "=> Shutdown Wildfly" | ||
$JBOSS_CLI -c ":shutdown" | ||
|
||
echo "=> DEPLOY WARs" | ||
cp ${DEPLOY_DIR}/* ${WILDFLY_HOME}/standalone/deployments/ | ||
|
||
touch wildfly/wildfly.started | ||
|
||
echo "=> Start Wildfly" | ||
$WILDFLY_HOME/bin/standalone.sh -b=0.0.0.0 -c standalone.xml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The readme mentions the |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if symphony-ws requires a specific name here.