Update environment paths in .env and Dockerfile: Change PRISMA_DATA_PATH and UPLOADS_PATH for consistency with new directory structure. Adjust DATABASE_URL in Dockerfile to point to the correct database location and ensure Prisma Client generation and migration deployment are included in the build process.
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m30s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m30s
This commit is contained in:
4
.env
4
.env
@@ -8,5 +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"
|
PRISMA_DATA_PATH="/Users/julien.froidefond/Sites/DAIS/public/got-gaming/data"
|
||||||
UPLOADS_PATH="/Users/julien.froidefond/Sites/DAIS/got-mc/public/uploads"
|
UPLOADS_PATH="/Users/julien.froidefond/Sites/DAIS/public/got-gaming/public/uploads"
|
||||||
22
Dockerfile
22
Dockerfile
@@ -19,10 +19,13 @@ RUN corepack enable && corepack prepare pnpm@latest --activate
|
|||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
ENV DATABASE_URL="file:/tmp/build.db"
|
ENV DATABASE_URL="file:/app/data/dev.db"
|
||||||
RUN pnpm prisma generate
|
|
||||||
|
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
|
# Générer Prisma Client et valider les migrations dans le builder
|
||||||
|
RUN pnpm prisma generate && \
|
||||||
|
pnpm prisma migrate deploy
|
||||||
|
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
|
||||||
# Stage 3: Runner
|
# Stage 3: Runner
|
||||||
@@ -39,7 +42,7 @@ RUN addgroup --system --gid 1001 nodejs && \
|
|||||||
|
|
||||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||||
|
|
||||||
# Copier les fichiers nécessaires
|
# Copier les fichiers nécessaires (tout est déjà préparé dans le builder)
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
|
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||||||
COPY --from=builder /app/package.json ./package.json
|
COPY --from=builder /app/package.json ./package.json
|
||||||
@@ -47,13 +50,8 @@ COPY --from=builder /app/pnpm-lock.yaml ./pnpm-lock.yaml
|
|||||||
COPY --from=builder /app/next.config.js ./next.config.js
|
COPY --from=builder /app/next.config.js ./next.config.js
|
||||||
COPY --from=builder /app/prisma ./prisma
|
COPY --from=builder /app/prisma ./prisma
|
||||||
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
|
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
|
||||||
|
# Copier node_modules avec Prisma Client déjà généré
|
||||||
ENV DATABASE_URL="file:/tmp/build.db"
|
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
|
||||||
|
|
||||||
# Installer seulement les dépendances de production puis générer Prisma Client
|
|
||||||
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
|
|
||||||
pnpm install --frozen-lockfile --prod && \
|
|
||||||
pnpm dlx prisma generate
|
|
||||||
|
|
||||||
ENV DATABASE_URL="file:/app/data/dev.db"
|
ENV DATABASE_URL="file:/app/data/dev.db"
|
||||||
|
|
||||||
@@ -66,7 +64,6 @@ RUN echo '#!/bin/sh' > /app/entrypoint.sh && \
|
|||||||
echo 'mkdir -p /app/data' >> /app/entrypoint.sh && \
|
echo 'mkdir -p /app/data' >> /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 'exec pnpm start' >> /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
|
||||||
@@ -76,6 +73,5 @@ USER nextjs
|
|||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
ENV HOSTNAME="0.0.0.0"
|
ENV HOSTNAME="0.0.0.0"
|
||||||
ENV DATABASE_URL="file:/app/data/dev.db"
|
|
||||||
|
|
||||||
ENTRYPOINT ["./entrypoint.sh"]
|
ENTRYPOINT ["./entrypoint.sh"]
|
||||||
|
|||||||
Reference in New Issue
Block a user