Skip to content

Commit

Permalink
feat: update devcontainer and docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
thonatos authored Nov 3, 2022
1 parent 1af96b3 commit 502dd6c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
6 changes: 5 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"mongodb.mongodb-vscode"
// "mongodb.mongodb-vscode"
]
}
},

"forwardPorts": [
"phpmyadmin:80"
],

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
}
31 changes: 19 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,19 @@ services:
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
# network_mode: service:db
# links:
# - redis
# - mysql
depends_on:
- mysql
- redis
networks:
- cnpm

# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
# networks:
# - cnpm

# Uncomment the next line to use a non-root user for all processes.
# user: node

Expand All @@ -28,7 +36,7 @@ services:
volumes:
- cnpm-redis:/data
ports:
- 6379:6379
- 6379
networks:
- cnpm

Expand All @@ -37,17 +45,17 @@ services:
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
restart: always
environment:
MYSQL_ROOT_PASSWORD:
MYSQL_ROOT_PASSWORD: root
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
# MYSQL_DATABASE: 'cnpmcore_unittest'
MYSQL_DATABASE: 'cnpmcore_unittest'
MYSQL_USER: user
MYSQL_PASSWORD: pass
volumes:
- cnpm-mysql:/var/lib/mysql
# - ./conf.d/mysql/:/etc/mysql/conf.d
# - ./init.d/mysql/:/docker-entrypoint-initdb.d
ports:
- 3306:3306
- 3306
networks:
- cnpm

Expand All @@ -61,19 +69,18 @@ services:
MYSQL_USER: user
MYSQL_PASSWORD: pass
PMA_HOST: 'mysql'
ports:
- 8080:80
networks:
- cnpm
depends_on:
- mysql
ports:
- 80
networks:
- cnpm

volumes:
cnpm-redis:
cnpm-mysql:


networks:
cnpm:
name: cnpm
driver: bridge
driver: bridge
4 changes: 2 additions & 2 deletions test/TestUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ export class TestUtil {

static getMySqlConfig() {
return {
host: process.env.MYSQL_HOST || 'localhost',
host: process.env.MYSQL_HOST || 'mysql',
port: process.env.MYSQL_PORT || 3306,
user: process.env.MYSQL_USER || 'root',
password: process.env.MYSQL_PASSWORD,
password: process.env.MYSQL_PASSWORD || '',
multipleStatements: true,
};
}
Expand Down

0 comments on commit 502dd6c

Please sign in to comment.