mirror of
https://github.com/SrIzan10/hctv.git
synced 2026-06-06 00:56:56 +00:00
feat: move back to yarn and finally fix builds
This commit is contained in:
41
.dockerignore
Normal file
41
.dockerignore
Normal file
@@ -0,0 +1,41 @@
|
||||
# Version control
|
||||
.git
|
||||
.gitignore
|
||||
|
||||
# Dependencies
|
||||
**/node_modules
|
||||
.pnpm-store
|
||||
|
||||
# Build outputs
|
||||
**/dist
|
||||
**/.next
|
||||
**/build
|
||||
**/out
|
||||
|
||||
# Development files
|
||||
**/.env*
|
||||
!**/.env.example
|
||||
**/.vscode
|
||||
**/.idea
|
||||
**/coverage
|
||||
**/.turbo
|
||||
**/.cache
|
||||
|
||||
# System files
|
||||
.DS_Store
|
||||
**/Thumbs.db
|
||||
|
||||
# Logs
|
||||
**/npm-debug.log*
|
||||
**/yarn-debug.log*
|
||||
**/yarn-error.log*
|
||||
**/pnpm-debug.log*
|
||||
|
||||
# Test files
|
||||
**/__tests__
|
||||
**/*.test.*
|
||||
**/*.spec.*
|
||||
|
||||
packages/db/generated
|
||||
dev/
|
||||
flv-module/
|
||||
@@ -1,35 +0,0 @@
|
||||
# Ignore node_modules and build output
|
||||
node_modules
|
||||
.next
|
||||
out
|
||||
|
||||
# Ignore logs and temporary files
|
||||
*.log
|
||||
*.tmp
|
||||
*.swp
|
||||
|
||||
# Ignore local environment files
|
||||
.env
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
# Ignore Docker files
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
|
||||
# Ignore git files
|
||||
.git
|
||||
.gitignore
|
||||
|
||||
# Ignore editor directories and files
|
||||
.vscode
|
||||
.idea
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
|
||||
# Ignore other unnecessary files
|
||||
README.md
|
||||
dev/
|
||||
flv-module/
|
||||
@@ -1,44 +1,45 @@
|
||||
FROM oven/bun:alpine AS builder
|
||||
FROM node:lts-alpine AS base
|
||||
|
||||
FROM base AS builder
|
||||
RUN apk update
|
||||
RUN apk add --no-cache libc6-compat
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package.json bun.lockb ./
|
||||
|
||||
# Install dependencies
|
||||
RUN bun install
|
||||
|
||||
# Copy app files
|
||||
# Replace <your-major-version> with the major version installed in your repository. For example:
|
||||
# RUN yarn global add turbo@^2
|
||||
RUN yarn global add turbo@^2
|
||||
COPY . .
|
||||
|
||||
# Build app
|
||||
RUN bun run build
|
||||
|
||||
# Stage 2: Production
|
||||
FROM oven/bun:alpine AS runner
|
||||
# Generate a partial monorepo with a pruned lockfile for a target workspace.
|
||||
# Assuming "web" is the name entered in the project's package.json: { name: "web" }
|
||||
RUN turbo prune @hctv/web --docker
|
||||
|
||||
# Add lockfile and package.json's of isolated subworkspace
|
||||
FROM base AS installer
|
||||
RUN apk update
|
||||
RUN apk add --no-cache libc6-compat
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
# First install the dependencies (as they change less often)
|
||||
COPY --from=builder /app/out/json/ .
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
# Copy necessary files
|
||||
COPY --from=builder /app/next.config.mjs ./
|
||||
COPY --from=builder /app/package.json ./
|
||||
COPY --from=builder /app/bun.lockb ./
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/.next ./.next
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
# Build the project
|
||||
COPY --from=builder /app/out/full/ .
|
||||
RUN yarn turbo run build
|
||||
|
||||
# Install production dependencies only
|
||||
RUN apk add --no-cache openssl
|
||||
RUN bun pm cache rm && bun run prepare
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
|
||||
# Remove unnecessary files
|
||||
RUN rm -rf /app/.git \
|
||||
/app/.next/cache \
|
||||
/app/README.md
|
||||
# Don't run production as root
|
||||
RUN addgroup --system --gid 1001 nodejs
|
||||
RUN adduser --system --uid 1001 nextjs
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 3000
|
||||
# Automatically leverage output traces to reduce image size
|
||||
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
||||
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalone ./
|
||||
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static
|
||||
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public
|
||||
|
||||
CMD ["bun", "start"]
|
||||
CMD node apps/web/server.js
|
||||
@@ -1,4 +1,12 @@
|
||||
const LIVE_SERVER_URL = process.env.NODE_ENV === 'production' ? 'https://backend.hctv.srizan.dev' : 'http://localhost:8888'
|
||||
import * as path from 'node:path';
|
||||
import { fileURLToPath } from 'url';
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const LIVE_SERVER_URL =
|
||||
process.env.NODE_ENV === 'production'
|
||||
? 'https://backend.hctv.srizan.dev'
|
||||
: 'http://localhost:8888';
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
images: {
|
||||
@@ -8,13 +16,15 @@ const nextConfig = {
|
||||
},
|
||||
{
|
||||
hostname: 'secure.gravatar.com',
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
env: {
|
||||
LIVE_SERVER_URL,
|
||||
},
|
||||
reactStrictMode: false,
|
||||
output: 'standalone',
|
||||
outputFileTracingRoot: path.join(__dirname, '../../'),
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"check-types": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hctv/db": "workspace:*",
|
||||
"@hctv/db": "*",
|
||||
"@hookform/resolvers": "^3.9.1",
|
||||
"@livekit/components-react": "^2.7.0",
|
||||
"@lucia-auth/adapter-prisma": "^4.0.1",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { validateRequest } from ".";
|
||||
import prisma from "../db";
|
||||
import prisma from '@hctv/db';
|
||||
|
||||
export async function getPersonalChannel(id?: string) {
|
||||
const { user } = await validateRequest();
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
"scripts": {
|
||||
"build": "turbo run build",
|
||||
"dev": "turbo run dev",
|
||||
"lint": "turbo run lint"
|
||||
"lint": "turbo run lint",
|
||||
"docker:web": "docker build -t srizan10/hclive -f apps/web/Dockerfile ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"turbo": "^2.4.4"
|
||||
},
|
||||
"packageManager": "pnpm@10.6.5"
|
||||
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
packages:
|
||||
- packages/*
|
||||
- apps/*
|
||||
@@ -2,7 +2,7 @@
|
||||
"$schema": "https://turbo.build/schema.json",
|
||||
"tasks": {
|
||||
"build": {
|
||||
"dependsOn": ["^db:generate", "^build"],
|
||||
"dependsOn": ["^db:generate", "prepare"],
|
||||
"outputs": [".next/**", "!.next/cache/**"]
|
||||
},
|
||||
"setup": {
|
||||
@@ -17,7 +17,7 @@
|
||||
"dependsOn": ["^check-types"]
|
||||
},
|
||||
"dev": {
|
||||
"dependsOn": ["^dd", "db:generate"],
|
||||
"dependsOn": ["dd", "db:generate"],
|
||||
"persistent": true,
|
||||
"cache": false
|
||||
},
|
||||
@@ -34,6 +34,9 @@
|
||||
},
|
||||
"db:deploy": {
|
||||
"cache": false
|
||||
},
|
||||
"prepare": {
|
||||
"cache": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user