Update environment and Docker configuration: Add PRISMA_DATA_PATH and UPLOADS_PATH to .env, modify docker-compose.yml to ensure correct volume mapping for uploads, and enhance Dockerfile to streamline file copying and directory creation for uploads.
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 6m22s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 6m22s
This commit is contained in:
2
.env
2
.env
@@ -8,3 +8,5 @@
|
|||||||
DATABASE_URL="file:./data/dev.db"
|
DATABASE_URL="file:./data/dev.db"
|
||||||
AUTH_SECRET="your-secret-key-change-this-in-production"
|
AUTH_SECRET="your-secret-key-change-this-in-production"
|
||||||
AUTH_URL="http://localhost:3000"
|
AUTH_URL="http://localhost:3000"
|
||||||
|
PRISMA_DATA_PATH="/Users/julien.froidefond/Sites/DAIS/got-mc/data"
|
||||||
|
UPLOADS_PATH="/Users/julien.froidefond/Sites/DAIS/got-mc/public/uploads"
|
||||||
25
Dockerfile
25
Dockerfile
@@ -38,21 +38,26 @@ RUN addgroup --system --gid 1001 nodejs && \
|
|||||||
|
|
||||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||||
|
|
||||||
COPY --from=builder /app/public ./public
|
# Copier les fichiers nécessaires
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||||||
|
|
||||||
COPY --from=builder /app/prisma ./prisma
|
|
||||||
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
|
|
||||||
COPY --from=builder /app/package.json ./package.json
|
COPY --from=builder /app/package.json ./package.json
|
||||||
COPY --from=builder /app/pnpm-lock.yaml ./pnpm-lock.yaml
|
COPY --from=builder /app/pnpm-lock.yaml ./pnpm-lock.yaml
|
||||||
|
COPY --from=builder /app/next.config.js ./next.config.js
|
||||||
|
COPY --from=builder /app/prisma ./prisma
|
||||||
|
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
|
||||||
|
|
||||||
ENV DATABASE_URL="file:/app/data/dev.db"
|
ENV DATABASE_URL="file:/tmp/build.db"
|
||||||
RUN pnpm add prisma @prisma/client @prisma/adapter-better-sqlite3 better-sqlite3 --prod && \
|
|
||||||
|
# Installer seulement les dépendances de production puis générer Prisma Client
|
||||||
|
RUN pnpm install --frozen-lockfile --prod && \
|
||||||
pnpm dlx prisma generate
|
pnpm dlx prisma generate
|
||||||
|
|
||||||
|
ENV DATABASE_URL="file:/app/data/dev.db"
|
||||||
|
|
||||||
# Create data directory for SQLite database and uploads directories
|
# Create data directory for SQLite database and uploads directories
|
||||||
RUN mkdir -p /app/data /app/public/uploads /app/public/uploads/backgrounds && chown -R nextjs:nodejs /app/data /app/public/uploads
|
RUN mkdir -p /app/data /app/public/uploads /app/public/uploads/backgrounds && \
|
||||||
|
chown -R nextjs:nodejs /app/data /app/public/uploads
|
||||||
|
|
||||||
RUN echo '#!/bin/sh' > /app/entrypoint.sh && \
|
RUN echo '#!/bin/sh' > /app/entrypoint.sh && \
|
||||||
echo 'set -e' >> /app/entrypoint.sh && \
|
echo 'set -e' >> /app/entrypoint.sh && \
|
||||||
@@ -60,7 +65,7 @@ RUN echo '#!/bin/sh' > /app/entrypoint.sh && \
|
|||||||
echo 'mkdir -p /app/public/uploads' >> /app/entrypoint.sh && \
|
echo 'mkdir -p /app/public/uploads' >> /app/entrypoint.sh && \
|
||||||
echo 'mkdir -p /app/public/uploads/backgrounds' >> /app/entrypoint.sh && \
|
echo 'mkdir -p /app/public/uploads/backgrounds' >> /app/entrypoint.sh && \
|
||||||
echo 'pnpm dlx prisma migrate deploy || true' >> /app/entrypoint.sh && \
|
echo 'pnpm dlx prisma migrate deploy || true' >> /app/entrypoint.sh && \
|
||||||
echo 'exec node server.js' >> /app/entrypoint.sh && \
|
echo 'exec pnpm start' >> /app/entrypoint.sh && \
|
||||||
chmod +x /app/entrypoint.sh && \
|
chmod +x /app/entrypoint.sh && \
|
||||||
chown nextjs:nodejs /app/entrypoint.sh
|
chown nextjs:nodejs /app/entrypoint.sh
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ services:
|
|||||||
# Persist database (override DATA_PATH env var to change location)
|
# Persist database (override DATA_PATH env var to change location)
|
||||||
- ${PRISMA_DATA_PATH:-/Volumes/EXTERNAL_USB/sites/got-gaming/data}:/app/data
|
- ${PRISMA_DATA_PATH:-/Volumes/EXTERNAL_USB/sites/got-gaming/data}:/app/data
|
||||||
# Persist uploaded images (avatars and backgrounds)
|
# Persist uploaded images (avatars and backgrounds)
|
||||||
- ${UPLOADS_PATH:-./uploads}:/app/public/uploads
|
- ${UPLOADS_PATH:-./public/uploads}:/app/public/uploads
|
||||||
- ./prisma/migrations:/app/prisma/migrations
|
- ./prisma/migrations:/app/prisma/migrations
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
labels:
|
labels:
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
output: "standalone",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = nextConfig;
|
module.exports = nextConfig;
|
||||||
|
|||||||
Reference in New Issue
Block a user