feat: Add Docker support with production and development configurations for backend and frontend
This commit is contained in:
22
client/Dockerfile
Normal file
22
client/Dockerfile
Normal file
@@ -0,0 +1,22 @@
|
||||
# Production build with Vite preview server
|
||||
FROM node:18-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm ci
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build the app
|
||||
RUN npm run build
|
||||
|
||||
# Expose port for Vite preview server
|
||||
EXPOSE 3000
|
||||
|
||||
# Serve built files with Vite preview
|
||||
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "3000"]
|
||||
19
client/Dockerfile.dev
Normal file
19
client/Dockerfile.dev
Normal file
@@ -0,0 +1,19 @@
|
||||
# Development Dockerfile with hot reload
|
||||
FROM node:18-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Expose Vite dev server port
|
||||
EXPOSE 3000
|
||||
|
||||
# Start Vite dev server
|
||||
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
|
||||
@@ -6,7 +6,8 @@
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview"
|
||||
"preview": "vite preview",
|
||||
"serve": "vite preview --host 0.0.0.0 --port 3000"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^18.2.0",
|
||||
|
||||
Reference in New Issue
Block a user