chore: docker and other stuff

This commit is contained in:
2025-02-16 16:51:20 +01:00
parent ef378c1857
commit 7813e3fc05
6 changed files with 84 additions and 14 deletions

33
.dockerignore Normal file
View File

@@ -0,0 +1,33 @@
# Ignore node_modules and build output
node_modules
.next
out
# Ignore logs and temporary files
*.log
*.tmp
*.swp
# Ignore local environment files
.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/

45
Dockerfile Normal file
View File

@@ -0,0 +1,45 @@
# Stage 1: Building the code
FROM node:lts-alpine AS builder
WORKDIR /app
# Copy package files
COPY package.json yarn.lock ./
# Install dependencies
RUN yarn install --frozen-lockfile
# Copy app files
COPY . .
# Build app
RUN yarn build
# Stage 2: Production
FROM node:lts-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# Copy necessary files
COPY --from=builder /app/next.config.mjs ./
COPY --from=builder /app/package.json ./
COPY --from=builder /app/yarn.lock ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/prisma ./prisma
# Install production dependencies only
RUN apk add --no-cache openssl
RUN yarn install --frozen-lockfile --production && \
yarn cache clean
# Remove unnecessary files
RUN rm -rf /app/.git \
/app/.next/cache \
/app/README.md
EXPOSE 3000
CMD ["yarn", "start"]

View File

@@ -6,7 +6,7 @@
"dev": "docker compose --file dev/docker-compose.yml up -d && next dev --experimental-https --turbo",
"setup": "docker compose --file dev/docker-compose.yml up -d && prisma migrate deploy",
"build": "prisma generate && next build",
"start": "next start",
"start": "prisma migrate deploy && next start",
"lint": "next lint",
"db:generate": "prisma generate",
"db:migrate": "prisma migrate dev --name",

View File

@@ -5,9 +5,13 @@ import prisma from '@/lib/db';
import { Avatar, AvatarImage, AvatarFallback } from '@radix-ui/react-avatar';
import Image from 'next/image';
import Link from 'next/link';
import { redirect } from 'next/navigation';
export default async function Home() {
const { user } = await validateRequest();
if (!user?.hasOnboarded) {
redirect('/onboarding');
}
const streams = await prisma.streamInfo.findMany({
where: {
isLive: true,

View File

@@ -1,17 +1,5 @@
import { Button } from '@/components/ui/button';
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
} from '@/components/ui/dialog';
import { validateRequest } from '@/lib/auth';
import prisma from '@/lib/db';
import { UniversalForm } from '../UniversalForm/UniversalForm';
import { editStreamInfo } from '@/lib/form/actions';
import RegenerateKey from '../RegenerateKey/RegenerateKey';
import EditLivestreamDialog from './dialog';
export default async function EditLivestream() {

View File

@@ -19,7 +19,7 @@ import { ThemeSwitcher } from '../ThemeSwitcher/ThemeSwitcher';
import { Slack } from 'lucide-react';
import { SidebarTrigger } from '@/components/ui/sidebar';
export const links = [{ href: '/srizan', name: 'test stream' }];
export const links = [{ href: '/', name: 'home (placeholder link)' }];
function NavbarLinks() {
return (