-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
50 lines (36 loc) · 1.44 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Install pnpm
RUN npm install -g [email protected]
# Copy package files
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml lerna.json .npmrc ./
COPY packages/client/package.json ./packages/client/
# Set shamefully-hoist to true
RUN echo "shamefully-hoist=true" >> .npmrc
# Install all dependencies at the project level, skipping the prepare script
RUN pnpm install --frozen-lockfile --ignore-scripts
# Copy source files
COPY . .
# Navigate to client directory
WORKDIR /app/packages/client
# Build the Remix frontend
RUN pnpm run build
# Production stage
FROM node:20-alpine
WORKDIR /app
# Install pnpm
RUN npm install -g [email protected]
# Copy package files and install dependencies
COPY --from=builder /app/pnpm-workspace.yaml /app/package.json /app/pnpm-lock.yaml /app/lerna.json /app/.npmrc ./
COPY --from=builder /app/packages/client/package.json ./packages/client/
RUN pnpm install --prod --frozen-lockfile --ignore-scripts
# Copy built assets from builder stage
COPY --from=builder /app/packages/client/build ./packages/client/build
COPY --from=builder /app/packages/client/public ./packages/client/public
# Set environment variables
ENV NODE_ENV=production
# Expose the port the app runs on
EXPOSE 3000
# Start the Remix server
CMD ["pnpm", "run", "--filter", "@data-river/client", "start"]