added some support to run with docker w/ burnettk

This commit is contained in:
jasquat 2022-06-06 12:27:27 -04:00
parent 768576169e
commit 59205987d6
8 changed files with 1010 additions and 2 deletions

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
### STAGE 1: Build ###
FROM quay.io/sartography/node:latest
RUN mkdir /app
WORKDIR /app
ADD package.json /app/
ADD package-lock.json /app/
COPY . /app/
RUN npm install && \
npm run build
RUN npm install -g serve
ENTRYPOINT ["/app/bin/boot_server_in_docker"]

37
bin/boot_server_in_docker Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/env bash
function error_handler() {
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
exit "$2"
}
trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail
# # run migrations
# export FLASK_APP=/app/src/spiffworkflow_backend
#
# if [ "${DOWNGRADE_DB:-}" = "true" ]; then
# echo 'Downgrading database...'
# poetry run flask db downgrade
# fi
#
# if [ "${UPGRADE_DB:-}" = "true" ]; then
# echo 'Upgrading database...'
# poetry run flask db upgrade
# fi
#
# port="${PORT0:-}"
# if [[ -z "$port" ]]; then
# port=7000
# fi
#
# additional_args=""
#
# if [[ "${APPLICATION_ROOT:-}" != "/" ]]; then
# additional_args="${additional_args} -e SCRIPT_NAME=${APPLICATION_ROOT}"
# fi
#
# # THIS MUST BE THE LAST COMMAND!
# exec poetry run gunicorn ${additional_args} --bind "0.0.0.0:$PORT0" --workers=3 --timeout 90 --log-level debug wsgi:app
exec serve -s build -l "$PORT0"

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
function error_handler() {
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
exit "$2"
}
trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail
# if [[ -z "${BPMN_SPEC_ABSOLUTE_DIR:-}" ]]; then
# script_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
# export BPMN_SPEC_ABSOLUTE_DIR="$script_dir/../../sample-process-models"
# fi
additional_args=""
if [[ "${RUN_WITH_DAEMON:-}" != "false" ]]; then
additional_args="${additional_args} -d"
fi
docker compose up --build $additional_args

12
docker-compose.yml Normal file
View File

@ -0,0 +1,12 @@
version: "3.8"
services:
spiffworkflow-frontend:
container_name: spiffworkflow-frontend
# command: tail -f /etc/hostname
build:
context: .
environment:
- APPLICATION_ROOT=/
- PORT0=7001
ports:
- "7001:7001"

920
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@
"react-dom": "^18.1.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"serve": "^13.0.2",
"web-vitals": "^2.1.4"
},
"scripts": {

View File

@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Spiffworkflow</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>

View File

@ -1,2 +1,8 @@
export const BACKEND_BASE_URL = "http://localhost:5000/v1.0"
var hostAndPort;
if (window.location.href.indexOf("167.172.242.138") > -1) {
hostAndPort = "167.172.242.138:7000"
} else {
hostAndPort = "localhost:5000"
}
export const BACKEND_BASE_URL = `http://${hostAndPort}/v1.0`
export const HOT_AUTH_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOm51bGx9.krsOjlSilPMu_3r7WkkUfKyr-h3HprXr6R4_FXRXz6Y"