docker: dockerize, make standalone, will move todos to issues

This commit is contained in:
Aidan 2025-05-08 23:35:20 -04:00
parent 9387a92aed
commit dc08cd05f9
4 changed files with 58 additions and 5 deletions

50
Dockerfile Normal file
View File

@ -0,0 +1,50 @@
FROM node:latest AS base
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
else echo "Lockfile not found." && exit 1; \
fi
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ENV NEXT_TELEMETRY_DISABLED=1
RUN \
if [ -f yarn.lock ]; then yarn run build; \
elif [ -f package-lock.json ]; then npm run build; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
else echo "Lockfile not found." && exit 1; \
fi
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 ./build/public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./build/
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./build/.next/static
USER nextjs
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
CMD ["node", "build/server.js"]

View File

@ -48,8 +48,3 @@ Please use common sense when contributing :)
This project does not use a custom user agent when interacting with the MusicBrainz API. This is because the LastPlayed component is rendered client-side and user agent support is not universal.
If bugs were to occur with my code, I believe it would be easier for MusicBrainz to block this way.
## To-Do
- [ ] Dockerize for easier deployment
- [ ] Use MusicBrainz recording collections for displaying data about music

7
docker-compose.yml Normal file
View File

@ -0,0 +1,7 @@
services:
aidxncc:
build: .
ports:
- 3000:3000
environment:
- NODE_ENV=production

View File

@ -1,6 +1,7 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: 'standalone',
images: {
remotePatterns: [
{