-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdockerfile
More file actions
51 lines (36 loc) · 958 Bytes
/
Copy pathdockerfile
File metadata and controls
51 lines (36 loc) · 958 Bytes
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
# Build stage
FROM node:20 AS build
WORKDIR /app
# Copy package files
COPY package.json package-lock.json ./
# Install dependencies
RUN npm install
# Copy all necessary files for Vite build
COPY index.html ./
COPY vite.config.js ./
COPY postcss.config.js ./
COPY tailwind.config.js ./
COPY src ./src
COPY public ./public
COPY devPostsMd ./devPostsMd
# Build the React application with Vite
RUN npm run build
# Production stage
FROM node:20-slim
WORKDIR /app
# Copy package files
COPY package.json package-lock.json ./
# Install production dependencies only
RUN npm install --production
# Copy built React app from build stage (Vite builds to 'build' directory based on your config)
COPY --from=build /app/build ./build
# Copy markdown posts directory
COPY devPostsMd ./devPostsMd
# Copy server file
COPY server.js ./
# Expose port
EXPOSE 5555
# Set environment to production
ENV NODE_ENV=production
# Start the server
CMD ["node", "server.js"]