feat: make flat-stack-presejpacky standalone with Docker and Makefile
This commit is contained in:
37
drills/flat-stack-presejpacky/Dockerfile
Normal file
37
drills/flat-stack-presejpacky/Dockerfile
Normal file
@@ -0,0 +1,37 @@
|
||||
# Stage 1: Build stage
|
||||
FROM node:24-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files and install dependencies
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
|
||||
# Copy the rest of the application files
|
||||
COPY . .
|
||||
|
||||
# Build frontend and server.ts
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Production stage
|
||||
FROM node:24-alpine AS runner
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Set production environment
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
|
||||
# Copy package files and install only production dependencies
|
||||
COPY package*.json ./
|
||||
RUN npm ci --only=production
|
||||
|
||||
# Copy built assets and compiled server from builder stage
|
||||
COPY --from=builder /app/dist ./dist
|
||||
COPY --from=builder /app/server.js ./server.js
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
# Run the server
|
||||
CMD ["node", "server.js"]
|
||||
Reference in New Issue
Block a user