diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..fe95dd4a --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,19 @@ +{ + "name": "Local Dev", + "build": { + "dockerfile": "../Dockerfile", + "context": ".." + }, + "workspaceMount": "source=${localWorkspaceFolder},target=/workspace/enki,type=bind,consistency=default", + "mounts": [], + "workspaceFolder": "/workspace/enki" +} + +// Commands to run when inside a devcontainer to get a PDF: +// +// npm --prefix ./bakery-js/ install +// npm --prefix ./bakery-js/ run build +// npm --prefix ./mathify/ install +// +// export $(cat cli.env | xargs) +// bash -xv ./dockerfiles/docker-entrypoint.sh all-pdf --repo tiny-book --book-slug book-slug-1 --ref main diff --git a/.gitmodules b/.gitmodules index a2f681c3..ceb331a6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -17,3 +17,6 @@ [submodule "cnxml"] path = cnxml url = https://github.com/openstax/cnxml +[submodule "poet"] + path = poet + url = https://github.com/openstax/poet diff --git a/Dockerfile b/Dockerfile index bbc89cc4..f23c23f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -94,6 +94,22 @@ COPY ./bakery-js/tsconfig*.json /workspace/enki/bakery-js/ RUN npm --prefix=/workspace/enki/bakery-js run build +COPY ./poet/package.json ./poet/package-lock.json ./poet/tsconfig*.json /workspace/enki/poet/ +# Maybe don't need the client files +COPY ./poet/client/package.json ./poet/client/package-lock.json /workspace/enki/poet/client/ +COPY ./poet/server/package.json ./poet/server/package-lock.json /workspace/enki/poet/server/ + +RUN npm --prefix=/workspace/enki/poet install + +COPY ./poet/server/src/ /workspace/enki/poet/server/src/ +COPY ./poet/common/src/ /workspace/enki/poet/common/src/ +COPY ./poet/server/tsconfig*.json /workspace/enki/poet/server/ +COPY ./poet/server/webpack.config.js /workspace/enki/poet/server/ + +# Just for notes: cd /workspace/enki/poet && ./node_modules/.bin/ts-node server/src/model/_cli.ts validate /tmp/build/0000000/_attic/IO_FETCHED +# RUN npm --prefix=/workspace/enki/poet run build:server + + # =========================== # Install Python Packages # =========================== @@ -348,6 +364,8 @@ COPY --from=build-python-stage \ /usr/local/bin/aws \ /usr/local/bin/ +COPY --from=build-bakery-js-stage /workspace/enki/poet/ /workspace/enki/poet/ + # Copy ce-styles COPY ./ce-styles/styles/output/ /workspace/enki/ce-styles/styles/output/ diff --git a/dockerfiles/steps/step-fetch.bash b/dockerfiles/steps/step-fetch.bash index d53a9ffa..dcdbbc15 100644 --- a/dockerfiles/steps/step-fetch.bash +++ b/dockerfiles/steps/step-fetch.bash @@ -85,6 +85,9 @@ else fi fi + +cd /workspace/enki/poet && ./node_modules/.bin/ts-node server/src/model/_cli.ts validate "$IO_FETCHED" + # Clean up the temporary credentials file if it exists if [[ -f $creds_dir ]]; then rm -rf $creds_dir # LCOV_EXCL_LINE diff --git a/poet b/poet new file mode 160000 index 00000000..268812f5 --- /dev/null +++ b/poet @@ -0,0 +1 @@ +Subproject commit 268812f5f0f93ec2471f56053b260cf5da7da76c