Skip to content

Commit b0cd9ee

Browse files
authored
Merge pull request jupyterhub#4443 from manics/node18
Update jsx dependencies as much as possible
2 parents c3d4885 + a2c39a4 commit b0cd9ee

File tree

4 files changed

+9521
-7656
lines changed

4 files changed

+9521
-7656
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
8585
publish-docker:
8686
runs-on: ubuntu-20.04
87-
timeout-minutes: 30
87+
timeout-minutes: 20
8888

8989
services:
9090
# So that we can test this in PRs/branches

Dockerfile

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,83 @@
2121
# your jupyterhub_config.py will be added automatically
2222
# from your docker directory.
2323

24+
######################################################################
25+
# This Dockerfile uses multi-stage builds with optimisations to build
26+
# the JupyterHub wheel on the native architecture only
27+
# https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/
28+
2429
ARG BASE_IMAGE=ubuntu:22.04
25-
FROM $BASE_IMAGE AS builder
30+
31+
32+
######################################################################
33+
# The JupyterHub wheel is pure Python so can be built for any platform
34+
# on the native architecture (avoiding QEMU emulation)
35+
FROM --platform=${BUILDPLATFORM:-linux/amd64} $BASE_IMAGE AS jupyterhub-builder
2636

2737
ENV DEBIAN_FRONTEND=noninteractive
28-
WORKDIR /src/jupyterhub
2938

30-
RUN apt update -q \
31-
&& apt install -yq --no-install-recommends \
39+
# Don't clear apt cache, and don't combine RUN commands, so that cached layers can
40+
# be reused in other stages
41+
42+
RUN apt-get update -qq \
43+
&& apt-get install -yqq --no-install-recommends \
3244
build-essential \
3345
ca-certificates \
46+
curl \
3447
locales \
3548
python3-dev \
3649
python3-pip \
3750
python3-pycurl \
3851
python3-venv \
52+
&& python3 -m pip install --no-cache-dir --upgrade setuptools pip build wheel
53+
# Ubuntu 22.04 comes with Nodejs 12 which is too old for building JupyterHub JS
54+
# It's fine at runtime though (used only by configurable-http-proxy)
55+
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
56+
&& apt-get install -yqq --no-install-recommends \
3957
nodejs \
40-
npm \
41-
&& apt clean \
42-
&& rm -rf /var/lib/apt/lists/* \
43-
&& python3 -m pip install --no-cache-dir --upgrade setuptools pip build wheel \
4458
&& npm install --global yarn
59+
60+
WORKDIR /src/jupyterhub
4561
# copy everything except whats in .dockerignore, its a
4662
# compromise between needing to rebuild and maintaining
4763
# what needs to be part of the build
4864
COPY . .
65+
66+
ARG PIP_CACHE_DIR=/tmp/pip-cache
67+
RUN --mount=type=cache,target=${PIP_CACHE_DIR} \
68+
python3 -m build --wheel
69+
70+
71+
######################################################################
72+
# All other wheels required by JupyterHub, some are platform specific
73+
FROM $BASE_IMAGE AS wheel-builder
74+
75+
ENV DEBIAN_FRONTEND=noninteractive
76+
77+
RUN apt-get update -qq \
78+
&& apt-get install -yqq --no-install-recommends \
79+
build-essential \
80+
ca-certificates \
81+
curl \
82+
locales \
83+
python3-dev \
84+
python3-pip \
85+
python3-pycurl \
86+
python3-venv \
87+
&& python3 -m pip install --no-cache-dir --upgrade setuptools pip build wheel
88+
89+
WORKDIR /src/jupyterhub
90+
91+
COPY --from=jupyterhub-builder /src/jupyterhub/dist/*.whl /src/jupyterhub/dist/
4992
ARG PIP_CACHE_DIR=/tmp/pip-cache
5093
RUN --mount=type=cache,target=${PIP_CACHE_DIR} \
51-
python3 -m build --wheel \
52-
&& python3 -m pip wheel --wheel-dir wheelhouse dist/*.whl
94+
python3 -m pip wheel --wheel-dir wheelhouse dist/*.whl
95+
96+
97+
######################################################################
98+
# The final JupyterHub image, platform specific
99+
FROM $BASE_IMAGE AS jupyterhub
53100

54-
FROM $BASE_IMAGE
55101
ENV DEBIAN_FRONTEND=noninteractive \
56102
SHELL=/bin/bash \
57103
LC_ALL=en_US.UTF-8 \
@@ -66,8 +112,8 @@ LABEL org.jupyter.service="jupyterhub"
66112

67113
WORKDIR /srv/jupyterhub
68114

69-
RUN apt update -q \
70-
&& apt install -yq --no-install-recommends \
115+
RUN apt-get update -qq \
116+
&& apt-get install -yqq --no-install-recommends \
71117
ca-certificates \
72118
curl \
73119
gnupg \
@@ -80,10 +126,9 @@ RUN apt update -q \
80126
&& locale-gen $LC_ALL \
81127
&& npm install -g configurable-http-proxy@^4.2.0 \
82128
# clean cache and logs
83-
&& rm -rf /var/lib/apt/lists/* /var/log/* /var/tmp/* ~/.npm \
84-
&& find / -type d -name '__pycache__' -prune -exec rm -rf {} \;
85-
# install the wheels we built in the first stage
86-
RUN --mount=type=cache,from=builder,source=/src/jupyterhub/wheelhouse,target=/tmp/wheelhouse \
129+
&& rm -rf /var/lib/apt/lists/* /var/log/* /var/tmp/* ~/.npm
130+
# install the wheels we built in the previous stage
131+
RUN --mount=type=cache,from=wheel-builder,source=/src/jupyterhub/wheelhouse,target=/tmp/wheelhouse \
87132
# always make sure pip is up to date!
88133
python3 -m pip install --no-compile --no-cache-dir --upgrade setuptools pip \
89134
&& python3 -m pip install --no-compile --no-cache-dir /tmp/wheelhouse/*

jsx/package.json

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -25,50 +25,49 @@
2525
"moduleNameMapper": {
2626
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
2727
"\\.(css|less)$": "identity-obj-proxy"
28-
}
28+
},
29+
"testEnvironment": "jsdom"
2930
},
3031
"dependencies": {
31-
"bootstrap": "^4.5.3",
32-
"history": "^5.0.0",
33-
"lodash.debounce": "^4.0.8",
34-
"prop-types": "^15.7.2",
35-
"react": "^17.0.1",
36-
"react-bootstrap": "^2.1.1",
37-
"react-dom": "^17.0.1",
38-
"react-icons": "^4.1.0",
39-
"react-multi-select-component": "^3.0.7",
40-
"react-redux": "^7.2.2",
41-
"react-router": "^5.2.0",
42-
"react-router-dom": "^5.2.0",
43-
"recompose": "npm:react-recompose@^0.31.2",
44-
"redux": "^4.0.5",
45-
"regenerator-runtime": "^0.13.9"
32+
"bootstrap": "^5.2.3",
33+
"history": "^5.3.0",
34+
"lodash": "^4.17.21",
35+
"prop-types": "^15.8.1",
36+
"react": "^17.0.2",
37+
"react-bootstrap": "^2.7.4",
38+
"react-dom": "^17.0.2",
39+
"react-icons": "^4.8.0",
40+
"react-multi-select-component": "^4.3.4",
41+
"react-redux": "^7.2.8",
42+
"react-router-dom": "^5.3.4",
43+
"recompose": "npm:react-recompose@^0.33.0",
44+
"redux": "^4.2.1",
45+
"regenerator-runtime": "^0.13.11"
4646
},
4747
"devDependencies": {
48-
"@babel/core": "^7.12.3",
49-
"@babel/preset-env": "^7.12.11",
50-
"@babel/preset-react": "^7.12.10",
51-
"@testing-library/jest-dom": "^5.15.1",
52-
"@testing-library/react": "^12.1.2",
48+
"@babel/core": "^7.21.4",
49+
"@babel/preset-env": "^7.21.4",
50+
"@babel/preset-react": "^7.18.6",
51+
"@testing-library/jest-dom": "^5.16.5",
52+
"@testing-library/react": "^12.1.5",
5353
"@testing-library/user-event": "^13.5.0",
54-
"@webpack-cli/serve": "^1.7.0",
55-
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.5",
56-
"babel-jest": "^26.6.3",
57-
"babel-loader": "^8.2.1",
58-
"css-loader": "^5.0.1",
59-
"enzyme": "^3.11.0",
60-
"eslint": "^7.18.0",
61-
"eslint-plugin-prettier": "^3.3.1",
62-
"eslint-plugin-react": "^7.22.0",
63-
"eslint-plugin-unused-imports": "^1.1.1",
54+
"@webpack-cli/serve": "^2.0.1",
55+
"babel-jest": "^29.5.0",
56+
"babel-loader": "^9.1.2",
57+
"css-loader": "^6.7.3",
58+
"eslint": "^8.38.0",
59+
"eslint-plugin-prettier": "^4.2.1",
60+
"eslint-plugin-react": "^7.32.2",
61+
"eslint-plugin-unused-imports": "^2.0.0",
6462
"file-loader": "^6.2.0",
6563
"identity-obj-proxy": "^3.0.0",
66-
"jest": "^26.6.3",
67-
"prettier": "^2.2.1",
68-
"sinon": "^13.0.1",
69-
"style-loader": "^2.0.0",
70-
"webpack": "^5.76.0",
71-
"webpack-cli": "^4.10.0",
72-
"webpack-dev-server": "^4.9.3"
64+
"jest": "^29.5.0",
65+
"jest-environment-jsdom": "^29.5.0",
66+
"prettier": "^2.8.7",
67+
"sinon": "^15.0.3",
68+
"style-loader": "^3.3.2",
69+
"webpack": "^5.79.0",
70+
"webpack-cli": "^5.0.1",
71+
"webpack-dev-server": "^4.13.3"
7372
}
7473
}

0 commit comments

Comments
 (0)