Dockerize

This commit is contained in:
Jake Runyan 2026-02-12 23:22:13 -08:00
parent 153c73f438
commit 74ee07d64f
8 changed files with 64 additions and 5 deletions

View File

@ -13,7 +13,9 @@
"Bash(timeout 10 npm run dev:*)", "Bash(timeout 10 npm run dev:*)",
"Bash(grep:*)", "Bash(grep:*)",
"Read(//c/Users/runya/Documents/repositories/recipes/recipes/docs/**)", "Read(//c/Users/runya/Documents/repositories/recipes/recipes/docs/**)",
"Bash(node scripts/import-recipes.js:*)" "Bash(node scripts/import-recipes.js:*)",
"Bash(powershell.exe -Command \"Test-Path ''c:\\\\Users\\\\runya\\\\Documents\\\\repositories\\\\cooking\\\\.next\\\\standalone\\\\server.js''\")",
"Bash(powershell.exe -Command:*)"
] ]
} }
} }

11
.dockerignore Normal file
View File

@ -0,0 +1,11 @@
node_modules
.next
.git
.gitignore
.claude
*.md
!README.md
Dockerfile
docker-compose.yml
.dockerignore
.env*

28
Dockerfile Normal file
View File

@ -0,0 +1,28 @@
FROM node:20-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
FROM node:20-alpine AS build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV HOSTNAME=0.0.0.0
ENV PORT=3000
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=build /app/public ./public
COPY --from=build --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=build --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
CMD ["node", "server.js"]

View File

@ -1,2 +1,4 @@
# cooking # cooking
Content-first recipe site. A content-first recipe site. See it in action [HERE](https://recipes.whitney.rip).

View File

@ -35,8 +35,7 @@ export default function AboutPage() {
Each recipe is organized in its own folder with: Each recipe is organized in its own folder with:
</p> </p>
<ul className="list-disc list-inside space-y-2 text-gray-600 dark:text-gray-400 ml-4"> <ul className="list-disc list-inside space-y-2 text-gray-600 dark:text-gray-400 ml-4">
<li>MDX file with recipe content and instructions</li> <li>MDX file with metadata frontmatter, recipe content, and instructions</li>
<li>metadata.json for tags and organization</li>
<li>Assets folder for images and other media</li> <li>Assets folder for images and other media</li>
</ul> </ul>
</section> </section>

View File

@ -64,7 +64,7 @@ export default function Home() {
<div className="w-full md:w-2/5 space-y-4 text-center md:text-left"> <div className="w-full md:w-2/5 space-y-4 text-center md:text-left">
<h2 className="text-3xl font-bold text-gray-900 dark:text-white">But Recipe Sites Suck!</h2> <h2 className="text-3xl font-bold text-gray-900 dark:text-white">But Recipe Sites Suck!</h2>
<p className="text-lg text-gray-600 dark:text-gray-400"> <p className="text-lg text-gray-600 dark:text-gray-400">
Monetized recipe sites don't bother me, but I do mind when sites have overly aggressive ad integrations that block or move around the main content. Many modern sites share the same user-unfriendly plugins. Monetized recipe sites don&apos;t bother me, but I do mind when sites have overly aggressive ad integrations that block or move around the main content. Many modern sites share the same user-unfriendly plugins.
</p> </p>
</div> </div>
</div> </div>

16
docker-compose.yml Normal file
View File

@ -0,0 +1,16 @@
services:
cooking:
build: .
restart: unless-stopped
networks:
- traefik
labels:
- "traefik.enable=true"
- "traefik.http.routers.cooking.rule=Host(`recipes.whitney.rip`)"
- "traefik.http.routers.cooking.entrypoints=websecure"
- "traefik.http.routers.cooking.tls.certresolver=letsencrypt"
- "traefik.http.services.cooking.loadbalancer.server.port=3000"
networks:
traefik:
external: true

View File

@ -2,6 +2,7 @@ import type { NextConfig } from "next";
import createMDX from '@next/mdx'; import createMDX from '@next/mdx';
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
output: 'standalone',
reactStrictMode: true, reactStrictMode: true,
pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'], pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'],
}; };