Fix Docker build: add native deps for bcrypt, simplify vite config
- Add python3/make/g++ to Alpine for bcrypt native compilation - Remove Socket.IO vite plugin (uses SvelteKit aliases unavailable at config level) - Use prisma db push instead of migrate deploy for initial setup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -1,6 +1,8 @@
|
||||
# Stage 1: Build
|
||||
FROM node:22-alpine AS builder
|
||||
|
||||
RUN apk add --no-cache python3 make g++
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
@@ -15,6 +17,8 @@ RUN npm run build
|
||||
# Stage 2: Production
|
||||
FROM node:22-alpine
|
||||
|
||||
RUN apk add --no-cache python3 make g++
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
@@ -26,8 +30,9 @@ RUN npx prisma generate
|
||||
COPY --from=builder /app/build ./build
|
||||
COPY --from=builder /app/server.js ./server.js
|
||||
|
||||
RUN apk del python3 make g++ && rm -rf /var/cache/apk/*
|
||||
RUN mkdir -p /app/uploads
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["sh", "-c", "npx prisma migrate deploy && node server.js"]
|
||||
CMD ["sh", "-c", "npx prisma db push --skip-generate && node server.js"]
|
||||
|
||||
+1
-17
@@ -1,23 +1,7 @@
|
||||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
import type { Plugin } from 'vite';
|
||||
|
||||
function socketIOPlugin(): Plugin {
|
||||
return {
|
||||
name: 'socket-io-dev',
|
||||
configureServer(server) {
|
||||
if (!server.httpServer) return;
|
||||
|
||||
// Dynamic import to avoid bundling socket.io in client
|
||||
import('./src/socket/index.js').then(({ initSocketIO }) => {
|
||||
initSocketIO(server.httpServer!);
|
||||
console.log('Socket.IO dev server initialized');
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [tailwindcss(), sveltekit(), socketIOPlugin()]
|
||||
plugins: [tailwindcss(), sveltekit()]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user