fix: build arg params
This commit is contained in:
parent
8aa1f4e6b7
commit
dea382a8c9
|
|
@ -0,0 +1,12 @@
|
|||
node_modules
|
||||
.next
|
||||
coverage
|
||||
storybook-static
|
||||
playwright-report
|
||||
test-results
|
||||
.git
|
||||
.gitignore
|
||||
Dockerfile*
|
||||
*.log
|
||||
.env
|
||||
.env.local
|
||||
|
|
@ -1,21 +1,2 @@
|
|||
# Environment variables example
|
||||
# Copy this file to .env.local and update the values as needed
|
||||
|
||||
# Node
|
||||
NODE_ENV=development
|
||||
|
||||
# Public
|
||||
NEXT_PUBLIC_AUTH_API_BASE_URL=https://localhost:3000/api
|
||||
|
||||
# Server
|
||||
DATABASE_URL="postgresql://vibecut:vibecut@localhost:5432/vibecut"
|
||||
|
||||
UPSTASH_REDIS_REST_URL=http://localhost:8079
|
||||
UPSTASH_REDIS_REST_TOKEN=example_token_here
|
||||
|
||||
MARBLE_WORKSPACE_KEY=your_workspace_key_here
|
||||
|
||||
FREESOUND_CLIENT_ID=your_client_id_here
|
||||
FREESOUND_API_KEY=your_api_key_here
|
||||
|
||||
MODAL_TRANSCRIPTION_URL=your_modal_url_here
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM node:20-bookworm-slim AS deps
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json .npmrc ./
|
||||
RUN npm ci
|
||||
|
||||
FROM node:20-bookworm-slim AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
ENV NODE_ENV=production
|
||||
RUN npm run build
|
||||
|
||||
FROM node:20-bookworm-slim AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME=0.0.0.0
|
||||
|
||||
RUN groupadd --system --gid 1001 nodejs \
|
||||
&& useradd --system --uid 1001 --gid nodejs nextjs
|
||||
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
import type { Config } from "drizzle-kit";
|
||||
import * as dotenv from "dotenv";
|
||||
import { webEnv } from "./src/env/web";
|
||||
|
||||
// Load the right env file based on environment
|
||||
if (webEnv.NODE_ENV === "production") {
|
||||
dotenv.config({ path: ".env.production" });
|
||||
} else {
|
||||
dotenv.config({ path: ".env.local" });
|
||||
}
|
||||
|
||||
export default {
|
||||
schema: "./src/schema.ts",
|
||||
dialect: "postgresql",
|
||||
migrations: {
|
||||
table: "drizzle_migrations",
|
||||
},
|
||||
dbCredentials: {
|
||||
url: webEnv.DATABASE_URL,
|
||||
},
|
||||
out: "./migrations",
|
||||
strict: webEnv.NODE_ENV === "production",
|
||||
} satisfies Config;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
import "./.next/dev/types/routes.d.ts";
|
||||
import "./.next/types/routes.d.ts";
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { webEnv } from "@/env/web";
|
||||
import { checkRateLimit } from "@/lib/rate-limit";
|
||||
import { type NextRequest, NextResponse } from "next/server";
|
||||
import { z } from "zod";
|
||||
import { checkRateLimit } from "@/lib/rate-limit";
|
||||
|
||||
const searchParamsSchema = z.object({
|
||||
q: z.string().max(500, "Query too long").optional(),
|
||||
|
|
@ -202,7 +201,7 @@ export async function GET(request: NextRequest) {
|
|||
|
||||
const params = new URLSearchParams({
|
||||
query: query || "",
|
||||
token: webEnv.FREESOUND_API_KEY,
|
||||
token: '',
|
||||
page: page.toString(),
|
||||
page_size: pageSize.toString(),
|
||||
sort: sortParam,
|
||||
|
|
|
|||
|
|
@ -2,14 +2,6 @@ import { z } from "zod";
|
|||
|
||||
const webEnvSchema = z.object({
|
||||
NODE_ENV: z.enum(["development", "test", "production"]).default("development"),
|
||||
DATABASE_URL: z.string().min(1),
|
||||
UPSTASH_REDIS_REST_URL: z.string().min(1),
|
||||
UPSTASH_REDIS_REST_TOKEN: z.string().min(1),
|
||||
FREESOUND_API_KEY: z.string().min(1),
|
||||
FREESOUND_CLIENT_ID: z.string().min(1).optional(),
|
||||
MARBLE_WORKSPACE_KEY: z.string().min(1).optional(),
|
||||
MODAL_TRANSCRIPTION_URL: z.string().min(1).optional(),
|
||||
NEXT_PUBLIC_AUTH_API_BASE_URL: z.string().min(1).optional(),
|
||||
});
|
||||
|
||||
export const webEnv = webEnvSchema.parse({
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
import { drizzle } from "drizzle-orm/postgres-js";
|
||||
import postgres from "postgres";
|
||||
import * as schema from "./schema";
|
||||
import { webEnv } from "@/env/web";
|
||||
|
||||
let _db: ReturnType<typeof drizzle> | null = null;
|
||||
|
||||
function getDb() {
|
||||
if (!_db) {
|
||||
const client = postgres(webEnv.DATABASE_URL);
|
||||
_db = drizzle(client, { schema });
|
||||
}
|
||||
|
||||
return _db;
|
||||
}
|
||||
|
||||
export const db = getDb();
|
||||
|
||||
export * from "./schema";
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
import { pgTable, text, timestamp, boolean } from "drizzle-orm/pg-core";
|
||||
|
||||
export const users = pgTable("users", {
|
||||
id: text("id").primaryKey(),
|
||||
|
||||
// todo: implement fully anonymous sign-in for privacy
|
||||
// we don't have any auth flows currently so this is fine for now
|
||||
name: text("name").notNull(),
|
||||
email: text("email").notNull().unique(),
|
||||
emailVerified: boolean("email_verified").default(false).notNull(),
|
||||
image: text("image"),
|
||||
createdAt: timestamp("created_at")
|
||||
.$defaultFn(() => /* @__PURE__ */ new Date())
|
||||
.notNull(),
|
||||
updatedAt: timestamp("updated_at")
|
||||
.$defaultFn(() => /* @__PURE__ */ new Date())
|
||||
.notNull(),
|
||||
}).enableRLS();
|
||||
|
||||
export const sessions = pgTable("sessions", {
|
||||
id: text("id").primaryKey(),
|
||||
expiresAt: timestamp("expires_at").notNull(),
|
||||
token: text("token").notNull().unique(),
|
||||
createdAt: timestamp("created_at").notNull(),
|
||||
updatedAt: timestamp("updated_at").notNull(),
|
||||
ipAddress: text("ip_address"),
|
||||
userAgent: text("user_agent"),
|
||||
userId: text("user_id")
|
||||
.notNull()
|
||||
.references(() => users.id, { onDelete: "cascade" }),
|
||||
}).enableRLS();
|
||||
|
||||
export const accounts = pgTable("accounts", {
|
||||
id: text("id").primaryKey(),
|
||||
accountId: text("account_id").notNull(),
|
||||
providerId: text("provider_id").notNull(),
|
||||
userId: text("user_id")
|
||||
.notNull()
|
||||
.references(() => users.id, { onDelete: "cascade" }),
|
||||
accessToken: text("access_token"),
|
||||
refreshToken: text("refresh_token"),
|
||||
idToken: text("id_token"),
|
||||
accessTokenExpiresAt: timestamp("access_token_expires_at"),
|
||||
refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
|
||||
scope: text("scope"),
|
||||
password: text("password"),
|
||||
createdAt: timestamp("created_at").notNull(),
|
||||
updatedAt: timestamp("updated_at").notNull(),
|
||||
}).enableRLS();
|
||||
|
||||
export const verifications = pgTable("verifications", {
|
||||
id: text("id").primaryKey(),
|
||||
identifier: text("identifier").notNull(),
|
||||
value: text("value").notNull(),
|
||||
expiresAt: timestamp("expires_at").notNull(),
|
||||
createdAt: timestamp("created_at").$defaultFn(
|
||||
() => /* @__PURE__ */ new Date(),
|
||||
),
|
||||
updatedAt: timestamp("updated_at").$defaultFn(
|
||||
() => /* @__PURE__ */ new Date(),
|
||||
),
|
||||
}).enableRLS();
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
import { Ratelimit } from "@upstash/ratelimit";
|
||||
import { Redis } from "@upstash/redis";
|
||||
import { webEnv } from "@/env/web";
|
||||
// import { webEnv } from "@/env/web";
|
||||
|
||||
const redis = new Redis({
|
||||
url: webEnv.UPSTASH_REDIS_REST_URL,
|
||||
token: webEnv.UPSTASH_REDIS_REST_TOKEN,
|
||||
url: '',
|
||||
token: '',
|
||||
});
|
||||
|
||||
export const baseRateLimit = new Ratelimit({
|
||||
|
|
|
|||
Loading…
Reference in New Issue