-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from FallenChromium/dockerized-web
Docker support
- Loading branch information
Showing
8 changed files
with
149 additions
and
11 deletions.
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,7 @@ | ||
.git | ||
.gitignore | ||
.github | ||
Dockerfile | ||
.dockerignore | ||
node_modules | ||
docs |
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,38 @@ | ||
#nodejs stage to build frontent | ||
FROM node:16-alpine AS web-buildenv | ||
|
||
WORKDIR /sc-web | ||
#Install sc-web build-time dependencies | ||
COPY package.json package-lock.json ./ | ||
RUN npm install | ||
#Build sc-web | ||
COPY . . | ||
RUN npm run build | ||
|
||
FROM ubuntu:focal as runtime | ||
USER root | ||
|
||
WORKDIR /sc-web | ||
# dependencies | ||
COPY --from=web-buildenv /sc-web/requirements.txt /sc-web/requirements.txt | ||
|
||
# install runtime dependencies | ||
# tini is a lightweight PID1 to forward interrupt signals | ||
RUN apt update && apt --no-install-recommends -y install python3-pip python3 tini | ||
RUN python3 -m pip install --no-cache-dir --default-timeout=100 -r requirements.txt | ||
|
||
# the app itself | ||
COPY --from=web-buildenv /sc-web/client /sc-web/client | ||
COPY --from=web-buildenv /sc-web/server /sc-web/server | ||
|
||
# Needed to populate KB on startup | ||
COPY --from=web-buildenv /sc-web/components /sc-web/components | ||
COPY --from=web-buildenv /sc-web/repo.path /sc-web/repo.path | ||
|
||
# config | ||
COPY --from=web-buildenv /sc-web/sc-web.ini /sc-web/sc-web.ini | ||
|
||
WORKDIR /sc-web/server | ||
|
||
EXPOSE 8000 | ||
ENTRYPOINT ["tini", "--", "/usr/bin/python3", "/sc-web/server/app.py" ] |
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
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 @@ | ||
./components/scg/kb |
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ tornado | |
sqlalchemy | ||
numpy | ||
configparser | ||
py-sc-client==0.2.0 | ||
py-sc-client==0.2.2 |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#!/bin/bash | ||
APP_ROOT_PATH=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd) | ||
|
||
cd ../server/ | ||
python3 app.py | ||
cd - | ||
python3 "$APP_ROOT_PATH"/server/app.py "$@" |
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
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