mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
remove docker addon
This commit is contained in:
@@ -26,8 +26,8 @@ export const dependencyVersionMap = {
|
|||||||
"@libsql/client": "^0.14.0",
|
"@libsql/client": "^0.14.0",
|
||||||
postgres: "^3.4.5",
|
postgres: "^3.4.5",
|
||||||
|
|
||||||
"@prisma/client": "^5.7.1",
|
"@prisma/client": "^6.5.0",
|
||||||
prisma: "^5.7.1",
|
prisma: "^6.5.0",
|
||||||
|
|
||||||
"vite-plugin-pwa": "^0.21.2",
|
"vite-plugin-pwa": "^0.21.2",
|
||||||
"@vite-pwa/assets-generator": "^0.2.6",
|
"@vite-pwa/assets-generator": "^0.2.6",
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ export async function setupAddons(
|
|||||||
addons: ProjectAddons[],
|
addons: ProjectAddons[],
|
||||||
packageManager: PackageManager,
|
packageManager: PackageManager,
|
||||||
) {
|
) {
|
||||||
if (addons.includes("docker")) {
|
// if (addons.includes("docker")) {
|
||||||
await setupDocker(projectDir);
|
// await setupDocker(projectDir);
|
||||||
}
|
// }
|
||||||
if (addons.includes("pwa")) {
|
if (addons.includes("pwa")) {
|
||||||
await setupPwa(projectDir);
|
await setupPwa(projectDir);
|
||||||
}
|
}
|
||||||
@@ -81,88 +81,6 @@ async function setupHusky(projectDir: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setupDocker(projectDir: string) {
|
|
||||||
const dockerfileContent = `FROM node:18-alpine AS base
|
|
||||||
|
|
||||||
# Install dependencies only when needed
|
|
||||||
FROM base AS deps
|
|
||||||
RUN apk add --no-cache libc6-compat
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
COPY package.json bun.lockb* yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
|
||||||
RUN \\
|
|
||||||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \\
|
|
||||||
elif [ -f package-lock.json ]; then npm ci; \\
|
|
||||||
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \\
|
|
||||||
elif [ -f bun.lockb ]; then yarn global add bun && bun install --frozen-lockfile; \\
|
|
||||||
else npm i; \\
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Build the app
|
|
||||||
FROM base AS builder
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# First build client
|
|
||||||
RUN npm run build -w @better-t/client
|
|
||||||
# Then build server
|
|
||||||
RUN npm run build -w @better-t/server
|
|
||||||
|
|
||||||
# Production image
|
|
||||||
FROM base AS runner
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
ENV NODE_ENV production
|
|
||||||
|
|
||||||
# Copy necessary files from builder
|
|
||||||
COPY --from=builder /app/package.json ./package.json
|
|
||||||
COPY --from=builder /app/packages/server/dist ./packages/server/dist
|
|
||||||
COPY --from=builder /app/packages/client/dist ./packages/client/dist
|
|
||||||
COPY --from=builder /app/node_modules ./node_modules
|
|
||||||
COPY --from=builder /app/packages/server/package.json ./packages/server/package.json
|
|
||||||
COPY --from=builder /app/packages/client/package.json ./packages/client/package.json
|
|
||||||
|
|
||||||
EXPOSE 3000
|
|
||||||
|
|
||||||
CMD ["node", "packages/server/dist/index.js"]
|
|
||||||
`;
|
|
||||||
|
|
||||||
const dockerComposeContent = `version: '3'
|
|
||||||
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
build: .
|
|
||||||
ports:
|
|
||||||
- "3000:3000"
|
|
||||||
environment:
|
|
||||||
- NODE_ENV=production
|
|
||||||
- TURSO_CONNECTION_URL=\${TURSO_CONNECTION_URL}
|
|
||||||
- TURSO_AUTH_TOKEN=\${TURSO_AUTH_TOKEN}
|
|
||||||
- CORS_ORIGIN=\${CORS_ORIGIN}
|
|
||||||
restart: always
|
|
||||||
`;
|
|
||||||
|
|
||||||
const dockerignoreContent = `.git
|
|
||||||
node_modules
|
|
||||||
**/node_modules
|
|
||||||
**/dist
|
|
||||||
.env
|
|
||||||
.env.*
|
|
||||||
`;
|
|
||||||
|
|
||||||
await fs.writeFile(path.join(projectDir, "Dockerfile"), dockerfileContent);
|
|
||||||
await fs.writeFile(
|
|
||||||
path.join(projectDir, "docker-compose.yml"),
|
|
||||||
dockerComposeContent,
|
|
||||||
);
|
|
||||||
await fs.writeFile(
|
|
||||||
path.join(projectDir, ".dockerignore"),
|
|
||||||
dockerignoreContent,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function setupPwa(projectDir: string) {
|
async function setupPwa(projectDir: string) {
|
||||||
const pwaTemplateDir = path.join(PKG_ROOT, "template/with-pwa");
|
const pwaTemplateDir = path.join(PKG_ROOT, "template/with-pwa");
|
||||||
if (await fs.pathExists(pwaTemplateDir)) {
|
if (await fs.pathExists(pwaTemplateDir)) {
|
||||||
|
|||||||
@@ -187,11 +187,6 @@ async function updatePackageConfigurations(
|
|||||||
serverPackageJson.scripts["db:local"] = "turso dev --db-file local.db";
|
serverPackageJson.scripts["db:local"] = "turso dev --db-file local.db";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.auth) {
|
|
||||||
serverPackageJson.scripts["auth:generate"] =
|
|
||||||
"npx @better-auth/cli generate --output ./src/db/auth-schema.ts";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.orm === "prisma") {
|
if (options.orm === "prisma") {
|
||||||
serverPackageJson.scripts["db:push"] = "prisma db push";
|
serverPackageJson.scripts["db:push"] = "prisma db push";
|
||||||
serverPackageJson.scripts["db:studio"] = "prisma studio";
|
serverPackageJson.scripts["db:studio"] = "prisma studio";
|
||||||
|
|||||||
@@ -174,9 +174,5 @@ function generateScriptsList(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auth) {
|
|
||||||
scripts += `\n- \`cd packages/server && ${packageManagerRunCmd} auth:generate\`: Generate authentication schema`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return scripts;
|
return scripts;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ async function main() {
|
|||||||
.option("--postgres", "Use PostgreSQL database")
|
.option("--postgres", "Use PostgreSQL database")
|
||||||
.option("--auth", "Include authentication")
|
.option("--auth", "Include authentication")
|
||||||
.option("--no-auth", "Exclude authentication")
|
.option("--no-auth", "Exclude authentication")
|
||||||
.option("--docker", "Include Docker setup")
|
|
||||||
.option("--pwa", "Include Progressive Web App support")
|
.option("--pwa", "Include Progressive Web App support")
|
||||||
.option("--tauri", "Include Tauri desktop app support")
|
.option("--tauri", "Include Tauri desktop app support")
|
||||||
.option("--biome", "Include Biome for linting and formatting")
|
.option("--biome", "Include Biome for linting and formatting")
|
||||||
@@ -74,8 +73,7 @@ async function main() {
|
|||||||
...("git" in options && { git: options.git }),
|
...("git" in options && { git: options.git }),
|
||||||
...("install" in options && { noInstall: !options.install }),
|
...("install" in options && { noInstall: !options.install }),
|
||||||
...("turso" in options && { turso: options.turso }),
|
...("turso" in options && { turso: options.turso }),
|
||||||
...((options.docker ||
|
...((options.pwa ||
|
||||||
options.pwa ||
|
|
||||||
options.tauri ||
|
options.tauri ||
|
||||||
options.biome ||
|
options.biome ||
|
||||||
options.husky ||
|
options.husky ||
|
||||||
@@ -84,7 +82,6 @@ async function main() {
|
|||||||
options.addons === false
|
options.addons === false
|
||||||
? []
|
? []
|
||||||
: ([
|
: ([
|
||||||
...(options.docker ? ["docker"] : []),
|
|
||||||
...(options.pwa ? ["pwa"] : []),
|
...(options.pwa ? ["pwa"] : []),
|
||||||
...(options.tauri ? ["tauri"] : []),
|
...(options.tauri ? ["tauri"] : []),
|
||||||
...(options.biome ? ["biome"] : []),
|
...(options.biome ? ["biome"] : []),
|
||||||
|
|||||||
@@ -10,11 +10,6 @@ export async function getAddonsChoice(
|
|||||||
const response = await multiselect<ProjectAddons>({
|
const response = await multiselect<ProjectAddons>({
|
||||||
message: "Which Addons would you like to add?",
|
message: "Which Addons would you like to add?",
|
||||||
options: [
|
options: [
|
||||||
{
|
|
||||||
value: "docker",
|
|
||||||
label: "Docker setup",
|
|
||||||
hint: "Containerize your application",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
value: "pwa",
|
value: "pwa",
|
||||||
label: "PWA (Progressive Web App)",
|
label: "PWA (Progressive Web App)",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export type ProjectDatabase = "sqlite" | "postgres" | "none";
|
export type ProjectDatabase = "sqlite" | "postgres" | "none";
|
||||||
export type ProjectOrm = "drizzle" | "prisma" | "none";
|
export type ProjectOrm = "drizzle" | "prisma" | "none";
|
||||||
export type PackageManager = "npm" | "pnpm" | "yarn" | "bun";
|
export type PackageManager = "npm" | "pnpm" | "yarn" | "bun";
|
||||||
export type ProjectAddons = "docker" | "pwa" | "tauri" | "biome" | "husky";
|
export type ProjectAddons = "pwa" | "tauri" | "biome" | "husky";
|
||||||
|
|
||||||
export interface ProjectConfig {
|
export interface ProjectConfig {
|
||||||
projectName: string;
|
projectName: string;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"compile": "bun build --compile --minify --sourcemap --bytecode ./src/index.ts --outfile server"
|
"compile": "bun build --compile --minify --sourcemap --bytecode ./src/index.ts --outfile server"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hono/node-server": "^1.13.8",
|
"@hono/node-server": "^1.14.0",
|
||||||
"@hono/trpc-server": "^0.3.4",
|
"@hono/trpc-server": "^0.3.4",
|
||||||
"@trpc/server": "^11.0.0",
|
"@trpc/server": "^11.0.0",
|
||||||
"dotenv": "^16.4.7",
|
"dotenv": "^16.4.7",
|
||||||
|
|||||||
Reference in New Issue
Block a user