-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (36 loc) · 1.52 KB
/
Dockerfile
File metadata and controls
50 lines (36 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Этап 1: Сборка приложения (Builder)
FROM oven/bun:1.2 AS builder
WORKDIR /app
# Копируем файлы зависимостей и скрипт патча
COPY package.json bun.lock* ./
COPY scripts ./scripts
# Устанавливаем зависимости
RUN bun install
# Копируем всё остальное
COPY . .
# Собираем проект
RUN bun run build
# Этап 2: Производственный образ (Production)
FROM oven/bun:1.2-slim AS production
WORKDIR /app
# Безопасность и системные утилиты
RUN groupadd -r astro_group && useradd -r -g astro_group astro_user
RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/*
# Копируем билд и зависимости
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/node_modules ./node_modules
# Права доступа
RUN chown -R astro_user:astro_group .
USER astro_user
# --- ВНИМАНИЕ: Порт изменен на 3000 (согласно твоему astro.config) ---
EXPOSE 3000
# Переменные окружения для работы внутри контейнера
ENV HOST=0.0.0.0
ENV PORT=3000
ENV NODE_ENV=production
# Healthcheck на порт 3000
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:3000 || exit 1
# Запуск через bun
CMD ["bun", "./dist/server/entry.mjs"]