-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
36 lines (28 loc) · 982 Bytes
/
Dockerfile
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
# syntax=docker/dockerfile:1.2
###############################
# 1단계: 빌드 스테이지
###############################
FROM oven/bun:latest as builder
WORKDIR /app
# 패키지 파일 복사 후 의존성 설치
COPY package.json bun.lock ./
RUN bun install
# 앱 소스 전체 복사
COPY . .
# 환경변수 파일을 BuildKit 시크릿으로 받아서 주입 후 빌드
RUN --mount=type=secret,id=env \
export $(cat /run/secrets/env | grep -v '^#' | xargs) && \
bun run build
###############################
# 2단계: 실행 스테이지
###############################
FROM oven/bun:latest as runner
WORKDIR /app
# 빌드 결과물과 의존성만 복사
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3000
# 런타임은 외부에서 env 주입 (docker run --env-file 또는 -e 옵션)
CMD ["bun", "run", "start"]