fix: fine tune devcontainer (#329)

Co-authored-by: dicedtomato <35403473+diced@users.noreply.github.com>
This commit is contained in:
Jayvin Hernandez 2023-03-21 18:01:02 -07:00 committed by GitHub
parent 1b505d463c
commit c0d1b3d887
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 18 deletions

10
.devcontainer/Dockerfile Normal file
View file

@ -0,0 +1,10 @@
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-18
RUN usermod -l zipline node \
&& groupmod -n zipline node \
&& usermod -d /home/zipline zipline \
&& echo "zipline ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/zipline \
&& chmod 0440 /etc/sudoers.d/zipline \
&& sudo apt-get update && apt-get install gnupg2 -y
USER zipline

View file

@ -2,12 +2,15 @@
"name": "Zipline Codespace", "name": "Zipline Codespace",
"dockerComposeFile": "docker-compose.yml", "dockerComposeFile": "docker-compose.yml",
"service": "app", "service": "app",
"workspaceFolder": "/workspace", "workspaceFolder": "/zipline",
"forwardPorts": [3000, 5432],
"features": { "features": {
"ghcr.io/devcontainers/features/common-utils:2": {}, "ghcr.io/devcontainers/features/common-utils:2": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}, "username": "zipline"
"ghcr.io/devcontainers/features/node:1": {} },
"ghcr.io/devcontainers/features/docker-in-docker:1": {
"dockerDashComposeVersion": "v2",
"installDockerBuildx": true
}
}, },
"customizations": { "customizations": {
"vscode": { "vscode": {
@ -20,22 +23,34 @@
}, },
"editor.defaultFormatter": "esbenp.prettier-vscode", "editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true, "editor.formatOnSave": true,
"files.autoSave": "afterDelay" "files.autoSave": "afterDelay",
"terminal.integrated.persistentSessionReviveProcess": "never",
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/bin/zsh",
"env": {
"ZSH_THEME": "devcontainers"
}
}
}
}, },
"extensions": ["prisma.prisma", "esbenp.prettier-vscode", "dbaeumer.vscode-eslint"] "extensions": ["prisma.prisma", "esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
} }
}, },
"remoteUser": "zipline", "remoteUser": "zipline",
"updateRemoteUserUID": true,
"remoteEnv": { "remoteEnv": {
"CORE_DATABASE_URL": "postgres://postgres:postgres@localhost/zip10" "CORE_DATABASE_URL": "postgres://postgres:postgres@localhost/zip10"
}, },
"portsAttributes": { "portsAttributes": {
"3000": { "3000": {
"label": "Zipline", "label": "Zipline",
"onAutoForward": "openBrowser" "onAutoForward": "openBrowser"
}, },
"5432": { "5432": {
"label": "Postgres" "label": "Postgres"
} }
} },
"postCreateCommand": "sudo chown -R zipline:zipline /zipline && yarn install"
} }

View file

@ -1,12 +1,14 @@
version: '3.8' version: '3.8'
services: services:
app: app:
image: mcr.microsoft.com/vscode/devcontainers/javascript-node:0-18 build:
context: ./
dockerfile: Dockerfile
volumes: volumes:
- ..:/workspace:cached - ../:/zipline:cached
network_mode: service:db - uploads:/zipline/uploads
- node_modules:/zipline/node_modules
command: sleep infinity command: sleep infinity
user: zipline
db: db:
image: postgres:latest image: postgres:latest
restart: unless-stopped restart: unless-stopped
@ -19,4 +21,5 @@ services:
volumes: volumes:
pg_data: pg_data:
uploads:
node_modules: