fix: correct build output path and guard devtools plugin in production
This commit is contained in:
@@ -9,16 +9,17 @@ COPY . .
|
|||||||
|
|
||||||
ARG STRAPI_URL=https://strapi.moshariri.com
|
ARG STRAPI_URL=https://strapi.moshariri.com
|
||||||
ENV STRAPI_URL=$STRAPI_URL
|
ENV STRAPI_URL=$STRAPI_URL
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
RUN bun run build
|
RUN set -e && bun run build && echo "Build output:" && ls -la dist/server/
|
||||||
|
|
||||||
# Stage 2 — production runtime
|
# Stage 2 — production runtime
|
||||||
FROM node:22-alpine AS runner
|
FROM node:22-alpine AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=builder /app/.output ./.output
|
COPY --from=builder /app/dist ./dist
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
CMD ["node", ".output/server/index.mjs"]
|
CMD ["node", "dist/server/server.js"]
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev --port 3000",
|
"dev": "vite dev --port 3000",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"start": "node .output/server/index.mjs",
|
"start": "node dist/server/server.js",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"lint": "eslint",
|
"lint": "eslint",
|
||||||
|
|||||||
@@ -6,9 +6,16 @@ import { tanstackStart } from '@tanstack/react-start/plugin/vite'
|
|||||||
import viteReact from '@vitejs/plugin-react'
|
import viteReact from '@vitejs/plugin-react'
|
||||||
import tailwindcss from '@tailwindcss/vite'
|
import tailwindcss from '@tailwindcss/vite'
|
||||||
|
|
||||||
|
const isProd = process.env['NODE_ENV'] === 'production'
|
||||||
|
|
||||||
const config = defineConfig({
|
const config = defineConfig({
|
||||||
resolve: { tsconfigPaths: true },
|
resolve: { tsconfigPaths: true },
|
||||||
plugins: [devtools(), tailwindcss(), tanstackStart(), viteReact()],
|
plugins: [
|
||||||
|
!isProd && devtools(),
|
||||||
|
tailwindcss(),
|
||||||
|
tanstackStart(),
|
||||||
|
viteReact(),
|
||||||
|
].filter(Boolean),
|
||||||
})
|
})
|
||||||
|
|
||||||
export default config
|
export default config
|
||||||
|
|||||||
Reference in New Issue
Block a user