chore: add dev containers
This commit is contained in:
parent
e400966117
commit
e344c3e6a4
7
.devcontainer/Dockerfile
Normal file
7
.devcontainer/Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
ARG VARIANT=18-bullseye
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:${VARIANT}
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||
|
||||
RUN npm install -g bun
|
17
.devcontainer/devcontainer.json
Normal file
17
.devcontainer/devcontainer.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "Comfy Deploy Dev",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "app",
|
||||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
||||
"postCreateCommand": "cd web && bun install && bun run migrate-local",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"biomejs.biome",
|
||||
"formulahendry.auto-rename-tag",
|
||||
"bradlc.vscode-tailwindcss",
|
||||
"stivo.tailwind-fold"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
48
.devcontainer/docker-compose.yml
Normal file
48
.devcontainer/docker-compose.yml
Normal file
@ -0,0 +1,48 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
|
||||
environment:
|
||||
VSCODE_DEV_CONTAINER: true
|
||||
|
||||
volumes:
|
||||
# Forwards the local Docker socket to the container.
|
||||
- /var/run/docker.sock:/var/run/docker-host.sock
|
||||
# Update this to wherever you want VS Code to mount the folder of your project
|
||||
- ../..:/workspaces:cached
|
||||
|
||||
# Overrides default command so things don't shut down after the process ends.
|
||||
# entrypoint: /usr/local/share/docker-init.sh
|
||||
command: sleep infinity
|
||||
postgres:
|
||||
image: "postgres:15.2-alpine"
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: verceldb
|
||||
ports:
|
||||
- "5480:5432"
|
||||
pg_proxy:
|
||||
image: ghcr.io/neondatabase/wsproxy:latest
|
||||
environment:
|
||||
APPEND_PORT: "postgres:5432"
|
||||
ALLOW_ADDR_REGEX: ".*"
|
||||
LOG_TRAFFIC: "true"
|
||||
ports:
|
||||
- "5481:80"
|
||||
depends_on:
|
||||
- postgres
|
||||
localstack:
|
||||
image: localstack/localstack:latest
|
||||
environment:
|
||||
SERVICES: s3
|
||||
ports:
|
||||
- 4566:4566
|
||||
volumes:
|
||||
- ../web/aws:/etc/localstack/init/ready.d
|
||||
- ../web/aws:/app/web/aws
|
||||
|
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -2,8 +2,8 @@
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"quickfix.biome": true,
|
||||
"source.organizeImports.biome": true
|
||||
"quickfix.biome": "explicit",
|
||||
"source.organizeImports.biome": "explicit"
|
||||
},
|
||||
"typescript.preferences.importModuleSpecifier": "non-relative",
|
||||
"spellright.language": ["en"],
|
||||
|
@ -9,6 +9,11 @@
|
||||
"recommended": true
|
||||
}
|
||||
},
|
||||
"json": {
|
||||
"parser": {
|
||||
"allowComments": true
|
||||
}
|
||||
},
|
||||
"vcs": {
|
||||
"enabled": true,
|
||||
"clientKind": "git",
|
||||
|
@ -12,10 +12,11 @@ let sslMode: string | boolean = process.env.SSL || "require";
|
||||
|
||||
if (sslMode === "false") sslMode = false;
|
||||
|
||||
console.log(migrationsFolderName, sslMode);
|
||||
let connectionString = process.env.POSTGRES_URL!;
|
||||
|
||||
const isDevContainer = process.env.VSCODE_DEV_CONTAINER !== undefined;
|
||||
if (isDevContainer) connectionString = connectionString.replace("localhost","host.docker.internal")
|
||||
|
||||
const connectionString = process.env.POSTGRES_URL!;
|
||||
console.log(connectionString);
|
||||
const sql = postgres(connectionString, { max: 1, ssl: sslMode as any });
|
||||
const db = drizzle(sql, {
|
||||
logger: true,
|
||||
|
@ -2,10 +2,18 @@ import * as schema from "./schema";
|
||||
import { neonConfig, Pool } from "@neondatabase/serverless";
|
||||
import { drizzle as neonDrizzle } from "drizzle-orm/neon-serverless";
|
||||
|
||||
const isDevContainer = process.env.REMOTE_CONTAINERS !== undefined;
|
||||
|
||||
// if we're running locally
|
||||
if (process.env.VERCEL_ENV !== "production") {
|
||||
// Set the WebSocket proxy to work with the local instance
|
||||
neonConfig.wsProxy = (host) => `${host}:5481/v1`;
|
||||
if (isDevContainer) {
|
||||
// Running inside a VS Code devcontainer
|
||||
neonConfig.wsProxy = (host) => `host.docker.internal:5481/v1`;
|
||||
} else {
|
||||
// Not running inside a VS Code devcontainer
|
||||
neonConfig.wsProxy = (host) => `${host}:5481/v1`;
|
||||
}
|
||||
// Disable all authentication and encryption
|
||||
neonConfig.useSecureWebSocket = false;
|
||||
neonConfig.pipelineTLS = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user