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
|
||||
|
||||
# Copy package files
|
||||
@@ -12,10 +14,30 @@ RUN cd frontend && npm install
|
||||
|
||||
# Copy source files
|
||||
COPY . .
|
||||
COPY frontend ./frontend
|
||||
|
||||
# Build frontend
|
||||
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 3000
|
||||
|
||||
|
||||
18
package.json
18
package.json
@@ -1,26 +1,28 @@
|
||||
{
|
||||
"name": "rsvp-manager",
|
||||
"version": "1.0.0",
|
||||
"description": "RSVP Manager - Combined Frontend and Backend",
|
||||
"main": "src/index.ts",
|
||||
"description": "RSVP Manager - A modern event RSVP management system",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"start": "node dist/index.js",
|
||||
"dev": "nodemon src/index.ts",
|
||||
"build": "tsc && cd frontend && npm run build",
|
||||
"dev": "ts-node-dev --respawn --transpile-only src/index.ts",
|
||||
"build": "tsc",
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^4.18.2",
|
||||
"mysql2": "^3.6.0",
|
||||
"mysql2": "^3.6.5",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/node": "^20.4.5",
|
||||
"@types/node": "^20.8.2",
|
||||
"@types/cors": "^2.8.13",
|
||||
"ts-node-dev": "^2.0.0",
|
||||
"typescript": "^4.9.5",
|
||||
"nodemon": "^3.0.1",
|
||||
"ts-node": "^10.9.1"
|
||||
"jest": "^29.7.0",
|
||||
"@types/jest": "^29.5.5",
|
||||
"ts-jest": "^29.1.1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user