forked from AnekCodesVibeCodeRepos/template-viber
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (38 loc) · 1.35 KB
/
Dockerfile
File metadata and controls
54 lines (38 loc) · 1.35 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
51
52
53
54
# ============================================================
# Stage 1: Install dependencies
# ============================================================
FROM oven/bun:1-alpine AS deps
WORKDIR /app
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
# ============================================================
# Stage 2: Build the application
# ============================================================
FROM oven/bun:1-alpine AS build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ENV NODE_ENV=production
ENV VITE_CJS_IGNORE_WARNING=true
RUN bun run build
# Prune dev dependencies after build
RUN bun install --frozen-lockfile --production && \
rm -rf /app/.cache
# ============================================================
# Stage 3: Production runtime
# ============================================================
FROM node:20-alpine AS production
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=8080
# Add non-root user for security
RUN addgroup --system --gid 1001 remix && \
adduser --system --uid 1001 remix
# Copy only what's needed for production
COPY --from=build /app/build ./build
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/package.json ./package.json
COPY --from=build /app/public ./public
USER remix
EXPOSE 8080
CMD ["sh", "-c", "PORT=${PORT_IN:-$PORT} npm run start"]