Docker works now

This commit is contained in:
2025-02-27 12:28:50 -06:00
parent c010ea4ea7
commit 8ea7faf483
3 changed files with 10 additions and 19 deletions

View File

@ -1,33 +1,29 @@
# Stage 1: Build the project
FROM node:18 as builder
# Set the working directory in the container
FROM node:18 AS builder
WORKDIR /app
# Copy package.json and pnpm-lock.yaml or package-lock.json (if using npm) to the working directory
COPY ../package.json ../pnpm-lock.yaml ./
# Copy package.json and pnpm-lock.yaml to the working directory
COPY package.json pnpm-lock.yaml ./
# Install dependencies
RUN npm install -g pnpm
RUN pnpm install
# Copy project files into the docker image
COPY ../ .
COPY . .
# Build the project
RUN pnpm run build
# Stage 2: Serve the app using a lightweight node image
FROM node:16-alpine
# Stage 2: Serve the app using the same version of Node
FROM node:18-alpine
WORKDIR /app
# Install a simple http server
RUN npm install -g serve
# Set the working directory to /app
WORKDIR /app
# Copy built assets from the builder stage
COPY --from=builder /app/dist /app
COPY --from=builder /app/dist ./
# Expose port 5000 for the server
EXPOSE 5000