From 8ea7faf4831cc5374f41934eb822aef73a841f61 Mon Sep 17 00:00:00 2001 From: gibbyb Date: Thu, 27 Feb 2025 12:28:50 -0600 Subject: [PATCH] Docker works now --- docker/Dockerfile | 20 ++++++++------------ docker/docker-compose.yml | 2 +- index.html | 7 +------ 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index fee1419..9f718bc 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index c9b5c4a..347cb95 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -16,7 +16,7 @@ services: restart: unless-stopped volumes: - ../:/app # mount the parent directory to /app in the container - command: serve -s /app -l 5000 + command: serve -s /app/dist -l 5000 networks: node_apps: diff --git a/index.html b/index.html index 62ea2a4..3c5e019 100644 --- a/index.html +++ b/index.html @@ -24,13 +24,8 @@ media="print" onload="this.media='all'" /> - - Unduck + Bang