diff --git a/Dockerfile b/Dockerfile index b0393ff..c9005aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,45 @@ -FROM node +FROM node:20-alpine AS base + +FROM base AS deps +WORKDIR /app + +RUN apk add --no-cache libc6-compat COPY package*.json ./ RUN npm ci -COPY ./ ./ +FROM base AS builder +WORKDIR /app + +COPY --from=deps /app/node_modules ./node_modules +COPY . . + +ENV NEXT_TELEMETRY_DISABLED 1 + RUN npm run build -CMD npm start +FROM base AS runner +WORKDIR /app + +ENV NODE_ENV production +ENV NEXT_TELEMETRY_DISABLED 1 + +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs + +COPY --from=builder /app/public ./public + +RUN mkdir .next +RUN chown nextjs:nodejs .next + +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static + +USER nextjs + +EXPOSE 3000 + +ENV PORT 3000 +ENV HOSTNAME "0.0.0.0" + +CMD ["node", "server.js"] diff --git a/docker-compose.yml b/docker-compose.yml index a3eeaf7..f5b8390 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,8 +3,17 @@ version: "3" services: redis: image: redis + command: + - redis-server + - --save + - "60" + - "1" + - --loglevel + - warning ports: - 6379:6379 + volumes: + - redis-data:/data app: build: . @@ -15,3 +24,6 @@ services: SPOTIFY_CLIENT_SECRET: $SPOTIFY_CLIENT_SECRET ports: - 3000:3000 + +volumes: + redis-data: diff --git a/next.config.js b/next.config.js index 658404a..c10e07d 100644 --- a/next.config.js +++ b/next.config.js @@ -1,4 +1,6 @@ /** @type {import('next').NextConfig} */ -const nextConfig = {}; +const nextConfig = { + output: "standalone", +}; module.exports = nextConfig; diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..bed17b7 Binary files /dev/null and b/public/favicon.ico differ diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index adfeb43..b45a72a 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -1,5 +1,3 @@ -"use server"; - import styles from "./page.module.css"; import { redirect } from "next/navigation"; import { exchangeAccessToken } from "@/utils/auth"; diff --git a/src/app/page.tsx b/src/app/page.tsx index dbb7277..495f6b1 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,5 +1,3 @@ -"use server"; - import { getQueue } from "@/utils/queue"; import styles from "./page.module.css"; import { redirect } from "next/navigation"; @@ -31,3 +29,5 @@ export default async function Home() { ); } + +export const dynamic = "force-dynamic";