fix: Try to fix dockerfile
All checks were successful
release-tag / release-image (push) Successful in 2m18s
All checks were successful
release-tag / release-image (push) Successful in 2m18s
This commit is contained in:
parent
3110683c7d
commit
b1a4edc136
28
Dockerfile
28
Dockerfile
@ -1,38 +1,44 @@
|
|||||||
# This Dockerfile uses `serve` npm package to serve the static files with node process.
|
# This Dockerfile uses `serve` npm package to serve the static files with node process.
|
||||||
# You can find the Dockerfile for nginx in the following link:
|
# You can find the Dockerfile for nginx in the following link:
|
||||||
# https://github.com/refinedev/dockerfiles/blob/main/vite/Dockerfile.nginx
|
# https://github.com/refinedev/dockerfiles/blob/main/vite/Dockerfile.nginx
|
||||||
|
|
||||||
FROM refinedev/node:20 AS base
|
FROM refinedev/node:20 AS base
|
||||||
|
|
||||||
FROM base as deps
|
FROM base AS deps
|
||||||
|
|
||||||
|
# Копируем только файлы зависимостей
|
||||||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
|
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
if [ -f yarn.lock ]; then yarn install --frozen-lockfile; \
|
||||||
elif [ -f package-lock.json ]; then npm ci; \
|
elif [ -f package-lock.json ]; then npm ci; \
|
||||||
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
|
elif [ -f pnpm-lock.yaml ]; then npm install -g pnpm && pnpm install --frozen-lockfile; \
|
||||||
else echo "Lockfile not found." && exit 1; \
|
else echo "❌ Lockfile not found." && exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FROM base as builder
|
FROM base AS builder
|
||||||
|
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
|
# Обязательно создать рабочую директорию
|
||||||
|
WORKDIR /app/refine
|
||||||
|
|
||||||
COPY --from=deps /app/refine/node_modules ./node_modules
|
COPY --from=deps /app/refine/node_modules ./node_modules
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN npm run build
|
# Добавлена проверка и вывод логов
|
||||||
|
RUN echo "🚧 Starting build..." && npm run build || (echo "❌ Build failed" && exit 1)
|
||||||
|
|
||||||
FROM base as runner
|
FROM base AS runner
|
||||||
|
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
RUN npm install -g serve
|
RUN npm install -g serve
|
||||||
|
|
||||||
|
WORKDIR /app/refine
|
||||||
|
|
||||||
COPY --from=builder /app/refine/dist ./
|
COPY --from=builder /app/refine/dist ./
|
||||||
|
|
||||||
USER refine
|
USER refine
|
||||||
|
|
||||||
CMD ["serve", "-s", ".", "-l", "3000"]
|
CMD ["serve", "-s", ".", "-l", "3000"]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user