Когда я изменяю свой локальный файл (express-server.js), я не вижу уведомления об изменении в терминале docker-compose. Это будет означать, что не происходит обновления файлов Docker-контейнеров. (строка 'check', напечатанная внизу выходных данных терминала, является результатом вызова console.log('check')
, но если я изменю строковый аргумент для этого локально, а затем сохраню, я не увижу вывод новой строки в терминале. (Это windows 7использование docker toolbox с oracle virtual toolbox)
Dockerfile:
FROM node:10.16.3
WORKDIR /usr/src/
COPY ./ ./
RUN npm install
CMD ["/bin/bash"]
docker-compose.yml
version: "3.7"
services:
facerecognitionbrain-api:
container_name: backend
build: ./
command: bash -c "ls && npm start"
working_dir: /usr/src/
environment:
POSTGRES_URI: postgres://sally:secret@postgres:5432/facerecognitionbrain-docker
links:
- postgres
ports:
- "3008:3008"
volumes:
- ./:/usr/src/facerecognitionbrain-api
postgres:
environment:
POSTGRES_USER: sally
POSTGRES_PASSWORD: secret
POSTGRES_DB: facerecognitionbrain-docker
POSTGRES_HOST: postgres
image: postgres
ports:
- "5432:5432"
вывод терминала после docker-compose up --build
D:\Dropbox\general\dev\web\projects\43 - face recognition\facerecognitionbrain-api>docker-compose up --build
Creating network "facerecognitionbrain-api_default" with the default driver
Building facerecognitionbrain-api
Step 1/5 : FROM node:10.16.3
---> 636ef87129d6
Step 2/5 : WORKDIR /usr/src/
---> Using cache
---> 3566e0441ff1
Step 3/5 : COPY ./ ./
---> 2e23c8e63b06
Step 4/5 : RUN npm install
---> Running in 5dd3a7c621a6
npm WARN facerecognitionbrain-api@1.0.0 No description
npm WARN facerecognitionbrain-api@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
audited 3489 packages in 7.482s
found 0 vulnerabilities
Removing intermediate container 5dd3a7c621a6
---> e82ecc7a13f6
Step 5/5 : CMD ["/bin/bash"]
---> Running in b2abce6baa46
Removing intermediate container b2abce6baa46
---> f777b1b42dff
Successfully built f777b1b42dff
Successfully tagged facerecognitionbrain-api_facerecognitionbrain-api:latest
Creating facerecognitionbrain-api_postgres_1 ... done
Creating backend ... done
Attaching to facerecognitionbrain-api_postgres_1, backend
postgres_1 | The files belonging to this database system will be owned by user "postgres".
postgres_1 | This user must also own the server process.
postgres_1 |
postgres_1 | The database cluster will be initialized with locale "en_US.utf8".
postgres_1 | The default database encoding has accordingly been set to "UTF8".
postgres_1 | The default text search configuration will be set to "english".
postgres_1 |
postgres_1 | Data page checksums are disabled.
postgres_1 |
postgres_1 | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgres_1 | creating subdirectories ... ok
postgres_1 | selecting dynamic shared memory implementation ... posix
postgres_1 | selecting default max_connections ... 100
postgres_1 | selecting default shared_buffers ... 128MB
postgres_1 | selecting default time zone ... Etc/UTC
postgres_1 | creating configuration files ... ok
postgres_1 | running bootstrap script ... ok
backend | Dockerfile
backend | config.js
backend | controllers
backend | docker-compose.yml
backend | express-server.js
backend | facerecognitionbrain-api
backend | hidden
backend | middleware
backend | node_modules
backend | package-lock.json
backend | package.json
postgres_1 | performing post-bootstrap initialization ... ok
backend |
backend | > facerecognitionbrain-api@1.0.0 start /usr/src
backend | > nodemon express-server.js
backend |
backend | [nodemon] 1.18.3
backend | [nodemon] to restart at any time, enter `rs`
backend | [nodemon] watching: *.*
postgres_1 | syncing data to disk ... ok
postgres_1 |
postgres_1 | initdb: warning: enabling "trust" authentication for local connections
postgres_1 | You can change this by editing pg_hba.conf or using the option -A, or
postgres_1 | --auth-local and --auth-host, the next time you run initdb.
postgres_1 |
postgres_1 | Success. You can now start the database server using:
postgres_1 |
postgres_1 | pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres_1 |
postgres_1 | waiting for server to start....2019-11-05 10:45:25.106 UTC [40] LOG: starting PostgreSQL 12.0 (Debian 12.0-2.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
postgres_1 | 2019-11-05 10:45:25.108 UTC [40] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_1 | 2019-11-05 10:45:25.138 UTC [41] LOG: database system was shut down at 2019-11-05 10:45:24 UTC
postgres_1 | 2019-11-05 10:45:25.144 UTC [40] LOG: database system is ready to accept connections
postgres_1 | done
postgres_1 | server started
postgres_1 | CREATE DATABASE
postgres_1 |
postgres_1 |
postgres_1 | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
postgres_1 |
postgres_1 | 2019-11-05 10:45:25.571 UTC [40] LOG: received fast shutdown request
postgres_1 | waiting for server to shut down...2019-11-05 10:45:25.572 UTC [40] LOG: aborting any active transactions
postgres_1 | 2019-11-05 10:45:25.581 UTC [40] LOG: background worker "logical replication launcher" (PID 47) exited with exit code 1
postgres_1 | 2019-11-05 10:45:25.581 UTC [42] LOG: shutting down
postgres_1 | .2019-11-05 10:45:25.592 UTC [40] LOG: database system is shut down
postgres_1 | done
postgres_1 | server stopped
postgres_1 |
postgres_1 | PostgreSQL init process complete; ready for start up.
postgres_1 |
postgres_1 | 2019-11-05 10:45:25.732 UTC [1] LOG: starting PostgreSQL 12.0 (Debian 12.0-2.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
postgres_1 | 2019-11-05 10:45:25.732 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
postgres_1 | 2019-11-05 10:45:25.733 UTC [1] LOG: listening on IPv6 address "::", port 5432
postgres_1 | 2019-11-05 10:45:25.735 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_1 | 2019-11-05 10:45:25.763 UTC [58] LOG: database system was shut down at 2019-11-05 10:45:25 UTC
backend | [nodemon] starting `node express-server.js`
backend | check
backend | app is running on port 3008
package.json
{
"name": "facerecognitionbrain-api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon express-server.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"bcrypt-nodejs": "0.0.3",
"body-parser": "^1.18.3",
"clarifai": "^2.9.1",
"cors": "^2.8.4",
"express": "^4.16.3",
"jsonwebtoken": "^8.3.0",
"knex": "^0.15.2",
"morgan": "^1.9.1",
"pg": "^7.4.3",
"redis": "^2.8.0"
},
"devDependencies": {
"nodemon": "^1.18.3"
}
}