feat: dockerfile stuff

This commit is contained in:
2025-01-11 16:37:47 +01:00
parent a216a503d8
commit 621299068b
4 changed files with 85 additions and 2 deletions

54
.dockerignore Normal file
View File

@@ -0,0 +1,54 @@
# Dependencies
node_modules
.pnp
.pnp.js
.yarn/install-state.gz
# Testing
coverage
.nyc_output
# Next.js
.next
out
# Production
build
dist
# Misc
.DS_Store
*.pem
.git
.gitignore
# Debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Local env files
.env
.env.*
.env.local
.env.development
.env.test
.env.production
# IDE
.idea
.vscode
*.swp
*.swo
# Project specific
README.md
dev/
public/uploads
Dockerfile
.dockerignore
docker-compose*.yml
# Cache
.eslintcache
*.tsbuildinfo

27
Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
# modified from https://github.com/leerob/next-self-host
FROM node:alpine AS base
# Stage 1: Install dependencies
FROM base AS deps
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
# Stage 2: Build the application
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN yarn run build
# Stage 3: Production server
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
EXPOSE 3000
CMD ["node", "server.js"]

View File

@@ -12,10 +12,12 @@ const nextConfig = {
images: {
remotePatterns: [
{
hostname: process.env.MINIO_ENDPOINT,
protocol: "https",
hostname: "**",
},
],
},
output: 'standalone',
};
export default nextConfig;

View File

@@ -1,7 +1,7 @@
import * as Minio from 'minio'
const minio = new Minio.Client({
endPoint: process.env.MINIO_ENDPOINT!,
endPoint: process.env.MINIO_ENDPOINT || 'play.min.io',
port: parseInt(process.env.MINIO_PORT || '9000'),
useSSL: process.env.MINIO_USE_SSL === 'true',
accessKey: process.env.MINIO_ACCESS_KEY!,