Revert Gemini Changes.

This commit is contained in:
吳元皓 2025-07-02 20:44:46 +08:00
parent 44fec99dbe
commit 34d5dc37db
3 changed files with 22 additions and 98 deletions

View File

@ -1,38 +1,36 @@
# If you have customized your output directory, please just remove it. :)
FROM oven/bun:latest as builder
FROM oven/bun:latest as builder
WORKDIR /app
WORKDIR /app
# Copy package files
COPY package.json ./
COPY bun.lock* package-lock.json* yarn.lock* ./
# Copy package files
COPY package.json ./
COPY bun.lock* package-lock.json* yarn.lock* ./
# Install dependencies
RUN bun pm untrusted
# Install dependencies
RUN bun pm untrusted
RUN bun install
RUN apt-get update && apt-get install -y postgresql-client
# Copy source files
COPY . .
RUN bun run generateVersionTag
# Build the application
RUN bun run build
# Copy source files
COPY . .
RUN bun run generateVersionTag
# Build the application
RUN bun run build
# Production stage
FROM oven/bun:latest
# Production stage
FROM oven/bun:latest
WORKDIR /app
WORKDIR /app
# Copy package files for production
COPY --from=builder /app/package.json ./
# Copy package files for production
COPY --from=builder /app/package.json ./
# Copy build outputs from builder
COPY --from=builder /app/.output /app/.output
# Copy build outputs from builder
COPY --from=builder /app/.output /app/.output
RUN bun install --production
RUN bun install --production
EXPOSE 3000
EXPOSE 3000
CMD ["bun", "run", "start"]
CMD ["bun", "run", "start"]

View File

@ -16,7 +16,6 @@
"docs:preview": "vitepress preview docs",
"wipedev": "./clean-dev-env.sh",
"generateVersionTag": "bun run versionTagGenerate.ts",
"db:export": "bun run scripts/db/export.ts"
},
"dependencies": {
"@fontsource-variable/noto-sans-tc": "^5.2.6",

View File

@ -1,73 +0,0 @@
import { exec } from 'child_process';
import { promises as fs } from 'fs';
import path from 'path';
// Function to get current date in YYYY-MM-DD format
function getCurrentDate() {
const date = new Date();
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
return `${year}-${month}-${day}`;
}
// Main function to export the database
async function exportDatabase() {
try {
// Database connection details from environment variables
const dbName = process.env.POSTGRES_DB;
const dbUser = process.env.POSTGRES_USER;
const dbHost = process.env.POSTGRES_HOST;
const dbPort = process.env.POSTGRES_PORT;
// Check if required environment variables are set
if (!dbName || !dbUser || !dbHost || !dbPort) {
console.error('Error: Missing required environment variables for database connection.');
console.error('Please ensure POSTGRES_DB, POSTGRES_USER, POSTGRES_HOST, and POSTGRES_PORT are set.');
return;
}
// Tables to exclude from the export
const excludedTables = ['users', 'user_sessions']; // Add any other tables to exclude here
// Path to the output directory
const outputDir = path.join(process.cwd(), 'exported_db');
await fs.mkdir(outputDir, { recursive: true });
// Path for the output SQL file
const currentDate = getCurrentDate();
const outputFilePath = path.join(outputDir, `db_export_${currentDate}.sql`);
// Construct the pg_dump command
let command = `pg_dump "postgresql://${dbUser}:${process.env.POSTGRES_PASSWORD}@${dbHost}:${dbPort}/${dbName}" -F c -f "${outputFilePath}"`;
// Add exclude-table flags for each table to be excluded
for (const table of excludedTables) {
command += ` --exclude-table-data=${table}`;
}
console.log('Starting database export...');
console.log(`Exporting to: ${outputFilePath}`);
console.log(`Excluding tables: ${excludedTables.join(', ')}`);
// Execute the pg_dump command
exec(command, (error, stdout, stderr) => {
if (error) {
console.error(`Export failed: ${error.message}`);
return;
}
if (stderr) {
console.error(`pg_dump stderr: ${stderr}`);
}
console.log('Database export completed successfully.');
console.log(`File saved to: ${outputFilePath}`);
});
} catch (err) {
console.error('An unexpected error occurred:', err);
}
}
// Run the export function
exportDatabase();