File tree 6 files changed +92
-17
lines changed
6 files changed +92
-17
lines changed 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*
8
8
9
9
.npmrc
10
10
package-lock.json
11
+ pnpm-lock.yaml
11
12
12
13
config /config.prod.ts
13
14
config /** /* .js
Original file line number Diff line number Diff line change @@ -6,7 +6,12 @@ WORKDIR /usr/src/app
6
6
# Install app dependencies
7
7
COPY . .
8
8
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 \
10
15
&& npminstall -c \
11
16
&& npm run tsc
12
17
Original file line number Diff line number Diff line change 1
- version : ' 3.6 '
1
+ version : ' 3.8 '
2
2
services :
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
+
3
28
redis :
4
29
image : redis:6-alpine
5
30
# command: redis-server --appendonly yes --requirepass cnpm
6
31
restart : always
7
32
volumes :
8
33
- cnpm-redis:/data
9
34
ports :
10
- - 6379:6379
35
+ - 6379
11
36
networks :
12
37
- cnpm
13
38
@@ -16,7 +41,7 @@ services:
16
41
command : --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
17
42
restart : always
18
43
environment :
19
- MYSQL_ROOT_PASSWORD :
44
+ MYSQL_ROOT_PASSWORD : root
20
45
MYSQL_ALLOW_EMPTY_PASSWORD : ' yes'
21
46
# MYSQL_DATABASE: 'cnpmcore_unittest'
22
47
MYSQL_USER : user
@@ -25,33 +50,30 @@ services:
25
50
- cnpm-mysql:/var/lib/mysql
26
51
# - ./conf.d/mysql/:/etc/mysql/conf.d
27
52
# - ./init.d/mysql/:/docker-entrypoint-initdb.d
53
+ - ./sql:/docker-entrypoint-initdb.d/sql
54
+ - ./prepare-database.sh:/docker-entrypoint-initdb.d/init.sh
28
55
ports :
29
- - 3306:3306
56
+ - 3306
30
57
networks :
31
58
- cnpm
32
59
33
60
# database explorer
34
- phpmyadmin :
35
- image : phpmyadmin
61
+ adminer :
62
+ image : adminer
36
63
restart : always
37
64
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
43
68
ports :
44
- - 8080:80
69
+ - 8080
45
70
networks :
46
71
- cnpm
47
- depends_on :
48
- - mysql
49
72
50
73
volumes :
51
74
cnpm-redis :
52
75
cnpm-mysql :
53
76
54
-
55
77
networks :
56
78
cnpm :
57
79
name : cnpm
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export class TestUtil {
49
49
host : process . env . MYSQL_HOST || '127.0.0.1' ,
50
50
port : process . env . MYSQL_PORT || 3306 ,
51
51
user : process . env . MYSQL_USER || 'root' ,
52
- password : process . env . MYSQL_PASSWORD ,
52
+ password : process . env . MYSQL_PASSWORD || '' ,
53
53
multipleStatements : true ,
54
54
} ;
55
55
}
You can’t perform that action at this time.
0 commit comments