working devcontainer

This commit is contained in:
2020-10-16 07:43:11 +00:00
committed by Stepan Usatiuk
parent 20865da8b9
commit 8bd57fcf9e
6 changed files with 65 additions and 12 deletions

View File

@@ -2,6 +2,8 @@
ARG VARIANT="14-buster"
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}
ENV DOCKERDEV=true
# Update args in docker-compose.yaml to set the UID/GID of the "node" user.
ARG USER_UID=1000
ARG USER_GID=$USER_UID

View File

@@ -39,7 +39,8 @@
"dbaeumer.vscode-eslint",
"mtxr.sqltools",
"mtxr.sqltools-driver-mysql",
"ms-vscode.vscode-typescript-tslint-plugin"
"visualstudioexptteam.vscodeintellicode",
"rvest.vs-code-prettier-eslint",
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
@@ -49,5 +50,5 @@
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm config set unsafe-perm=true && npm i && cd frontend && npm i",
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "node"
"remoteUser": "node"
}

View File

@@ -22,7 +22,7 @@ services:
network_mode: service:db
# Uncomment the next line to use a non-root user for all processes.
# user: node
user: node
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)
@@ -31,7 +31,7 @@ services:
image: mariadb:latest
restart: unless-stopped
volumes:
- mariadb-data:/var/lib/mysql
- photosmariadb-data:/var/lib/mysql
environment:
MYSQL_DATABASE: photos
MYSQL_USER: photos
@@ -42,7 +42,7 @@ services:
image: mariadb:latest
restart: unless-stopped
volumes:
- mariadbtest-data:/var/lib/mysql
- photosmariadbtest-data:/var/lib/mysql
environment:
MYSQL_DATABASE: photos_test
MYSQL_USER: photos
@@ -53,5 +53,5 @@ services:
# (Adding the "ports" property to this file will not forward from a Codespace.)
volumes:
mariadb-data:
mariadbtest-data:
photosmariadb-data:
photosmariadbtest-data:

View File

@@ -0,0 +1,25 @@
{
"type": "mariadb",
"host": "db",
"port": 3306,
"username": "photos",
"password": "photos",
"database": "photos",
"synchronize": true,
"logging": false,
"entities": [
"src/entity/**/*.ts"
],
"migrations": [
"src/migration/**/*.ts"
],
"subscribers": [
"src/subscriber/**/*.ts"
],
"cli": {
"entitiesDir": "src/entity",
"migrationsDir": "src/migration",
"subscribersDir": "src/subscriber"
},
"charset": "utf8mb4"
}

View File

@@ -0,0 +1,25 @@
{
"type": "mariadb",
"host": "dbtest",
"port": 3306,
"username": "photos",
"password": "photos",
"database": "photos_test",
"synchronize": true,
"logging": false,
"entities": [
"src/entity/**/*.ts"
],
"migrations": [
"src/migration/**/*.ts"
],
"subscribers": [
"src/subscriber/**/*.ts"
],
"cli": {
"entitiesDir": "src/entity",
"migrationsDir": "src/migration",
"subscribersDir": "src/subscriber"
},
"charset": "utf8mb4"
}

View File

@@ -78,7 +78,7 @@ export class User extends BaseEntity {
@AfterInsert()
async createDataDir(): Promise<void> {
await fs.mkdir(this.getDataPath());
await fs.mkdir(this.getDataPath(), { recursive: true });
}
@BeforeRemove()