Update Dockerfile and package.json for proper TypeScript build and deployment
This commit is contained in:
24
Dockerfile
24
Dockerfile
@@ -1,5 +1,7 @@
|
|||||||
FROM node:18-alpine
|
# Build stage
|
||||||
|
FROM node:18-alpine AS builder
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy package files
|
# Copy package files
|
||||||
@@ -12,10 +14,30 @@ RUN cd frontend && npm install
|
|||||||
|
|
||||||
# Copy source files
|
# Copy source files
|
||||||
COPY . .
|
COPY . .
|
||||||
|
COPY frontend ./frontend
|
||||||
|
|
||||||
# Build frontend
|
# Build frontend
|
||||||
RUN cd frontend && npm run build
|
RUN cd frontend && npm run build
|
||||||
|
|
||||||
|
# Build backend
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Production stage
|
||||||
|
FROM node:18-alpine
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package files
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# Install production dependencies only
|
||||||
|
RUN npm install --production
|
||||||
|
|
||||||
|
# Copy built files from builder stage
|
||||||
|
COPY --from=builder /app/dist ./dist
|
||||||
|
COPY --from=builder /app/frontend/build ./frontend/build
|
||||||
|
|
||||||
# Expose port
|
# Expose port
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
|
|||||||
18
package.json
18
package.json
@@ -1,26 +1,28 @@
|
|||||||
{
|
{
|
||||||
"name": "rsvp-manager",
|
"name": "rsvp-manager",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "RSVP Manager - Combined Frontend and Backend",
|
"description": "RSVP Manager - A modern event RSVP management system",
|
||||||
"main": "src/index.ts",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node dist/index.js",
|
"start": "node dist/index.js",
|
||||||
"dev": "nodemon src/index.ts",
|
"dev": "ts-node-dev --respawn --transpile-only src/index.ts",
|
||||||
"build": "tsc && cd frontend && npm run build",
|
"build": "tsc",
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"mysql2": "^3.6.0",
|
"mysql2": "^3.6.5",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"dotenv": "^16.3.1"
|
"dotenv": "^16.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/express": "^4.17.17",
|
"@types/express": "^4.17.17",
|
||||||
"@types/node": "^20.4.5",
|
"@types/node": "^20.8.2",
|
||||||
"@types/cors": "^2.8.13",
|
"@types/cors": "^2.8.13",
|
||||||
|
"ts-node-dev": "^2.0.0",
|
||||||
"typescript": "^4.9.5",
|
"typescript": "^4.9.5",
|
||||||
"nodemon": "^3.0.1",
|
"jest": "^29.7.0",
|
||||||
"ts-node": "^10.9.1"
|
"@types/jest": "^29.5.5",
|
||||||
|
"ts-jest": "^29.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user