feat:deploy using container
This commit is contained in:
43
Dockerfile
Normal file
43
Dockerfile
Normal file
@@ -0,0 +1,43 @@
|
||||
# Use Node.js 18 alpine as base image
|
||||
FROM node:18-alpine AS base
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
RUN npm run build
|
||||
|
||||
# Production stage
|
||||
FROM node:18-alpine AS production
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package.json ./
|
||||
|
||||
# Install only production dependencies
|
||||
RUN npm install --only=production
|
||||
|
||||
# Copy built application from build stage
|
||||
COPY --from=base /app/build ./build
|
||||
COPY --from=base /app/static ./static
|
||||
COPY --from=base /app/package.json ./
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
# Set environment
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
|
||||
# Start the application
|
||||
CMD ["node", "build"]
|
||||
Reference in New Issue
Block a user