Skip to content

Commit

Permalink
Move notebook generation to python
Browse files Browse the repository at this point in the history
  • Loading branch information
jdorn committed Sep 19, 2021
1 parent 259744b commit 48cc33d
Show file tree
Hide file tree
Showing 7 changed files with 315 additions and 494 deletions.
10 changes: 6 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Build and test artifacts
.git
.github
node_modules
packages/front-end/.next
packages/back-end/coverage
**/node_modules
**/coverage
**/.next
**/dist
**/*.log
**/dummy

# Docs package
# Other packages
packages/docs
packages/sdk-**
packages/stats

# Secrets / private data
**/*.env.local
Expand Down
26 changes: 20 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
FROM node:14-alpine
FROM python:slim

# Install python for stats models
RUN apk add --no-cache \
python3 \
py3-numpy \
py3-scipy
RUN apt-get update && \
apt-get install -y wget gnupg2 && \
echo "deb https://deb.nodesource.com/node_14.x buster main" > /etc/apt/sources.list.d/nodesource.list && \
wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && \
wget -qO- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
apt-get update && \
apt-get install -yqq nodejs=$(apt-cache show nodejs|grep Version|grep nodesource|cut -c 10-) yarn && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
pip3 install \
# gbstats \
nbformat \
numpy \
pandas \
scipy

WORKDIR /usr/local/src/app

Expand All @@ -18,6 +29,9 @@ RUN \
&& yarn build \
# Then do a clean install with only production dependencies
&& rm -rf node_modules \
&& rm -rf packages/back-end/node_modules \
&& rm -rf packages/front-end/node_modules \
&& rm -rf packages/front-end/.next/cache \
&& yarn install --frozen-lockfile --production=true --ignore-optional \
# Clear the yarn cache
&& yarn cache clean
Expand Down
2 changes: 1 addition & 1 deletion packages/back-end/src/controllers/experiments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export async function postSnapshotNotebook(req: AuthRequest, res: Response) {

res.status(200).json({
status: 200,
notebook: JSON.stringify(notebook, null, 2),
notebook,
});
}

Expand Down
Loading

0 comments on commit 48cc33d

Please sign in to comment.