File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Update the VARIANT arg in docker-compose.yml to pick a Node.js version
2+ {
3+ "name" : " Node.js && Redis && MySQL" ,
4+ "dockerComposeFile" : " ../docker-compose.yml" ,
5+ "service" : " app" ,
6+ "workspaceFolder" : " /workspaces/${localWorkspaceFolderBasename}" ,
7+
8+ // Configure tool-specific properties.
9+ "customizations" : {
10+ // Configure properties specific to VS Code.
11+ "vscode" : {
12+ // Add the IDs of extensions you want installed when the container is created.
13+ "extensions" : [
14+ ]
15+ }
16+ },
17+
18+ // Forwards ports
19+ "forwardPorts" : [
20+ 8080
21+ ],
22+ "portsAttributes" : {
23+ "8080" : {
24+ "label" : " Adminer" ,
25+ "onAutoForward" : " notify"
26+ }
27+ },
28+
29+ // Use 'postCreateCommand' to run commands after the container is created.
30+ "postCreateCommand" : [
31+ " bash .devcontainer/scripts/postCreateCommand.sh"
32+ ],
33+
34+ // Container Env
35+ "containerEnv" : {
36+ "MYSQL_HOST" : " mysql" ,
37+ "MYSQL_USER" : " root" ,
38+ "MYSQL_PASSWORD" : " root"
39+ },
40+
41+ // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
42+ "remoteUser" : " node"
43+ }
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ pnpm i
4+ socat TCP4-LISTEN:8080,reuseaddr,fork TCP:adminer:8080 &
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ lerna-debug.log*
88
99.npmrc
1010package-lock.json
11+ pnpm-lock.yaml
1112
1213config /config.prod.ts
1314config /** /* .js
Original file line number Diff line number Diff line change @@ -6,7 +6,12 @@ WORKDIR /usr/src/app
66# Install app dependencies
77COPY . .
88
9- RUN npm install -g npminstall --registry=https://registry.npmmirror.com \
9+ # NPM Mirror
10+ # npm install -g npminstall --registry=https://registry.npmmirror.com
11+ # apk add --no-cache socat \
12+ RUN apt-get update \
13+ && apt-get -y install socat \
14+ && npm install -g npminstall \
1015 && npminstall -c \
1116 && npm run tsc
1217
Original file line number Diff line number Diff line change 1- version : ' 3.6 '
1+ version : ' 3.8 '
22services :
3+ app :
4+ build :
5+ context : .
6+ dockerfile : Dockerfile
7+ volumes :
8+ - ../..:/workspaces:cached
9+
10+ # Overrides default command so things don't shut down after the process ends.
11+ command : sleep infinity
12+ depends_on :
13+ - mysql
14+ - redis
15+ networks :
16+ - cnpm
17+
18+ # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
19+ # networks:
20+ # - cnpm
21+
22+ # Uncomment the next line to use a non-root user for all processes.
23+ # user: node
24+
25+ # Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
26+ # (Adding the "ports" property to this file will not forward from a Codespace.)
27+
328 redis :
429 image : redis:6-alpine
530 # command: redis-server --appendonly yes --requirepass cnpm
631 restart : always
732 volumes :
833 - cnpm-redis:/data
934 ports :
10- - 6379:6379
35+ - 6379
1136 networks :
1237 - cnpm
1338
@@ -16,7 +41,7 @@ services:
1641 command : --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
1742 restart : always
1843 environment :
19- MYSQL_ROOT_PASSWORD :
44+ MYSQL_ROOT_PASSWORD : root
2045 MYSQL_ALLOW_EMPTY_PASSWORD : ' yes'
2146 # MYSQL_DATABASE: 'cnpmcore_unittest'
2247 MYSQL_USER : user
@@ -25,33 +50,30 @@ services:
2550 - cnpm-mysql:/var/lib/mysql
2651 # - ./conf.d/mysql/:/etc/mysql/conf.d
2752 # - ./init.d/mysql/:/docker-entrypoint-initdb.d
53+ - ./sql:/docker-entrypoint-initdb.d/sql
54+ - ./prepare-database.sh:/docker-entrypoint-initdb.d/init.sh
2855 ports :
29- - 3306:3306
56+ - 3306
3057 networks :
3158 - cnpm
3259
3360 # database explorer
34- phpmyadmin :
35- image : phpmyadmin
61+ adminer :
62+ image : adminer
3663 restart : always
3764 environment :
38- MYSQL_ROOT_PASSWORD :
39- MYSQL_ALLOW_EMPTY_PASSWORD : ' yes'
40- MYSQL_USER : user
41- MYSQL_PASSWORD : pass
42- PMA_HOST : ' mysql'
65+ ADMINER_DEFAULT_DB_HOST : ' mysql'
66+ depends_on :
67+ - mysql
4368 ports :
44- - 8080:80
69+ - 8080
4570 networks :
4671 - cnpm
47- depends_on :
48- - mysql
4972
5073volumes :
5174 cnpm-redis :
5275 cnpm-mysql :
5376
54-
5577networks :
5678 cnpm :
5779 name : cnpm
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export class TestUtil {
4949 host : process . env . MYSQL_HOST || '127.0.0.1' ,
5050 port : process . env . MYSQL_PORT || 3306 ,
5151 user : process . env . MYSQL_USER || 'root' ,
52- password : process . env . MYSQL_PASSWORD ,
52+ password : process . env . MYSQL_PASSWORD || '' ,
5353 multipleStatements : true ,
5454 } ;
5555 }
You can’t perform that action at this time.
0 commit comments