Skip to content

Commit

Permalink
Update dependencies and improve build process (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito authored Nov 21, 2023
1 parent 54459aa commit 7a45b90
Show file tree
Hide file tree
Showing 13 changed files with 7,571 additions and 19,548 deletions.
17 changes: 4 additions & 13 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,15 @@
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"files.eol": "\n",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/bin/bash"
}
},
"python.pythonPath": "/usr/local/bin/python",
"python.languageServer": "Pylance",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.formatting.provider": "black",
"python.analysis.typeCheckingMode": "basic",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
"python.testing.pytestPath": "/usr/local/py-utils/bin/pytest",
"python.testing.pytestArgs": [
"--profile"
Expand All @@ -40,6 +30,7 @@
"editor.rulers": [
88
],
"editor.defaultFormatter": "ms-python.black-formatter",
"licenser.license": "Custom",
"licenser.customHeaderFile": "/workspace/.devcontainer/license_header.txt"
},
Expand All @@ -48,8 +39,8 @@
"mikestead.dotenv",
"ms-azuretools.vscode-docker",
"ms-python.python",
"ms-python.isort",
"ms-python.vscode-pylance",
"ms-python.black-formatter",
"njpwerner.autodocstring",
"redhat.vscode-yaml",
"42crunch.vscode-openapi",
Expand All @@ -74,4 +65,4 @@
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {}
}
}
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ ENV PATH=$PATH:/home/node/.npm-global/bin

# install run script and npm modules
RUN python3 -m pip install --user -r /service/configure_build_serve/requirements.txt
RUN npm install
RUN npm install --only=prod
RUN npm install react-scripts
RUN /service/configure_build_serve/run.py --build
RUN rm -rf node_modules
RUN npm install -g serve

# build application and serve frontend
Expand Down
20 changes: 15 additions & 5 deletions configure_build_serve/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def build():
raise RuntimeError(
f"`npm` terminated with non-zero exit code: {exit_code_build}."
)



def serve(config: Config):
Expand All @@ -97,6 +98,7 @@ def serve(config: Config):
"../configure_build_serve/serve.json",
str(ROOT_DIR / "build"),
]

exit_code_serve = Popen(cmd_serve).wait()

raise RuntimeError(f"Serving of app was interrupted: {exit_code_serve}.")
Expand Down Expand Up @@ -135,11 +137,17 @@ def run():
root dir.""",
)

parser.add_argument(
"--build",
help="""If set, the script will build the web app for production.""",
action="store_true",
)


parser.add_argument(
"--dev",
help="""If set, the script will skip the build process and
will serve a development web server that will reload automatically
once changes are made to the source code.
help="""If set, the script will serve using a development web server that will
reload automatically once changes are made to the source code.
Please Note: do not use this option for production.""",
action="store_true",
)
Expand All @@ -155,9 +163,11 @@ def run():
if args.dev:
# run app using development server:
dev_serve(config)
else:
# build and serve production server:
elif args.build:
# just build the app:
build()
else:
# serve using production server:
serve(config)


Expand Down
Loading

0 comments on commit 7a45b90

Please sign in to comment.