diff --git a/Dockerfile b/Dockerfile index 4431aed831..e0d5b218e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,25 @@ -FROM node:10.9-slim as builder +FROM debian:bookworm-slim as base RUN apt-get update && apt-get install -y \ build-essential \ g++ \ gcc \ git \ - python2.7 \ + curl \ && rm -rf /var/lib/apt/lists/* -RUN ln -s /usr/bin/python2.7 /usr/bin/python2 +FROM base as builder +ENV NODE_VERSION=12.22.12 +ENV NVM_DIR="/root/.nvm" +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default \ + && npm install -g yarn + +ENV NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules +ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH FROM builder as build ARG PUBLIC_PATH diff --git a/docker-compose.exercises.yml b/docker-compose.exercises.yml new file mode 100644 index 0000000000..10ab140645 --- /dev/null +++ b/docker-compose.exercises.yml @@ -0,0 +1,14 @@ +version: '3.5' +services: + build: + command: bash -c "if [ -z \"`ls -A node_modules`\" ]; then yarn; fi && yarn serve exercises" + build: + context: . + target: builder + working_dir: /code + environment: + - "OX_PROJECT_HOST=0.0.0.0" + volumes: + - .:/code:cached + ports: + - "8001:8001" diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 643fa6d9c9..1312c76d20 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -6,6 +6,8 @@ services: context: . target: builder working_dir: /code + environment: + - "OX_PROJECT_HOST=0.0.0.0" volumes: - .:/code:cached ports: diff --git a/docker-quickstart.md b/docker-quickstart.md index 38d7105975..e40625c628 100644 --- a/docker-quickstart.md +++ b/docker-quickstart.md @@ -26,6 +26,8 @@ the js files will be served at `http://localhost:8000` the ui is available through the tutor-server project at `http://localhost:3001` +Something seem broken? See [Troubleshooting](#troubleshooting) + ## Run Exercises frontend ``` bash @@ -36,6 +38,8 @@ the js files will be served at `http://localhost:8001` You will need to start the exercises backend independently +Something seem broken? See [Troubleshooting](#troubleshooting) + ## node_modules if you need to update node modules run: @@ -53,5 +57,5 @@ docker-compose exec build ## Troubleshooting if you run into problems, try the following: -* rebuilding the build image with `docker-compose build` -* remove your node_modules directory +* rebuilding the build image with `docker-compose build` or `docker-compose -f build` (depending on your use case) +* remove your node_modules directory \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index a350e8ab3d..ce0496ba0f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -112,7 +112,7 @@ const config = { quiet: false, noInfo: false, clientLogLevel: 'warning', - host: 'localhost', + host, filename: '[name].js', hot: !isCI, liveReload: !isCI,