зеркало из https://github.com/docker/labs.git
Fix for #315
This commit is contained in:
Родитель
2fbfc8358e
Коммит
5eb8f4e75d
|
@ -23,11 +23,11 @@ We've created a simple application which includes an error. You can see the app
|
||||||
Let's take a look at the `Dockerfile`:
|
Let's take a look at the `Dockerfile`:
|
||||||
|
|
||||||
```
|
```
|
||||||
FROM node:8.2.1
|
FROM node:8.2.1-alpine
|
||||||
|
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
|
|
||||||
RUN npm install -g nodemon
|
RUN npm install -g nodemon@1.11.0
|
||||||
|
|
||||||
COPY package.json /code/package.json
|
COPY package.json /code/package.json
|
||||||
RUN npm install && npm ls
|
RUN npm install && npm ls
|
||||||
|
@ -66,7 +66,8 @@ A few things are going on here:
|
||||||
|
|
||||||
|
|
||||||
### Run the app
|
### Run the app
|
||||||
Using your terminal, navigate to the directory with the app files and start up the app:
|
|
||||||
|
Using your terminal, navigate to the *app* directory (where the docker-compose.yml file is located) and start up the application:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ docker-compose up
|
$ docker-compose up
|
||||||
|
@ -77,7 +78,7 @@ Docker Compose will build the image and start a container for the app. You shoul
|
||||||
Creating network "nodeexample_default" with the default driver
|
Creating network "nodeexample_default" with the default driver
|
||||||
Creating nodeexample_web_1
|
Creating nodeexample_web_1
|
||||||
Attaching to nodeexample_web_1
|
Attaching to nodeexample_web_1
|
||||||
web_1 | [nodemon] 1.9.2
|
web_1 | [nodemon] 1.11.0
|
||||||
web_1 | [nodemon] to restart at any time, enter `rs`
|
web_1 | [nodemon] to restart at any time, enter `rs`
|
||||||
web_1 | [nodemon] watching: *.*
|
web_1 | [nodemon] watching: *.*
|
||||||
web_1 | [nodemon] starting `node --inspect=0.0.0.0:5858 app.js`
|
web_1 | [nodemon] starting `node --inspect=0.0.0.0:5858 app.js`
|
||||||
|
@ -102,7 +103,8 @@ Create a boilerplate debugger config by clicking the gear icon and selecting “
|
||||||
|
|
||||||
![Image of VS Code dropdown list](images/dropdown.png "Image of Visual Studio Code dropdown list")
|
![Image of VS Code dropdown list](images/dropdown.png "Image of Visual Studio Code dropdown list")
|
||||||
|
|
||||||
A JSON file will be created and displayed. Replace its contents with the following:
|
A JSON file will be created and displayed (on the filesystem this file is located at *app/.vscode/launch.json*). Replace its contents with the following
|
||||||
|
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
|
@ -116,7 +118,7 @@ A JSON file will be created and displayed. Replace its contents with the followi
|
||||||
"restart": true,
|
"restart": true,
|
||||||
"sourceMaps": false,
|
"sourceMaps": false,
|
||||||
"outFiles": [],
|
"outFiles": [],
|
||||||
"localRoot": "${workspaceRoot}/app",
|
"localRoot": "${workspaceRoot}/",
|
||||||
"remoteRoot": "/code"
|
"remoteRoot": "/code"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -162,4 +164,4 @@ Remove the breakpoint and detach the debugger by clicking the stop button. Go ba
|
||||||
|
|
||||||
![Animated image of browser without error](images/attach.png "Animated image of browser without error")
|
![Animated image of browser without error](images/attach.png "Animated image of browser without error")
|
||||||
|
|
||||||
And that's it, you're done!
|
And that's it, you're done!
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
FROM node:8.2.1
|
FROM node:8.2.1-alpine
|
||||||
|
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
|
|
||||||
RUN npm install -g nodemon
|
RUN npm install -g nodemon@1.11.0
|
||||||
|
|
||||||
COPY package.json /code/package.json
|
COPY package.json /code/package.json
|
||||||
RUN npm install && npm ls
|
RUN npm install && npm ls
|
||||||
|
@ -10,4 +10,4 @@ RUN mv /code/node_modules /node_modules
|
||||||
|
|
||||||
COPY . /code
|
COPY . /code
|
||||||
|
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
version: "2"
|
version: "3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
build: .
|
build: .
|
||||||
command: nodemon --inspect=5858
|
command: nodemon --inspect=0.0.0.0:5858
|
||||||
volumes:
|
volumes:
|
||||||
- .:/code
|
- .:/code
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
- "5858:5858"
|
- "5858:5858"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче