diff --git a/demo/.dockerignore b/demo/.dockerignore new file mode 100644 index 00000000..df46e32e --- /dev/null +++ b/demo/.dockerignore @@ -0,0 +1,23 @@ +# Docker ignore for demo app + +# Dependencies +node_modules +**/node_modules + +# Build output +dist +build + +# Dockerfile itself +Dockerfile + +# Local development files (examples, add if needed) +# .env +# .env.local +# .vscode +# .idea +# *.log +# +# OS generated files +.DS_Store +Thumbs.db diff --git a/demo/Dockerfile b/demo/Dockerfile new file mode 100644 index 00000000..58d8255a --- /dev/null +++ b/demo/Dockerfile @@ -0,0 +1,44 @@ +# Stage 1: Build the Vue.js demo application +FROM node:18-alpine AS build-stage + +LABEL maintainer="Vue Advanced Chat Dev Team" +LABEL description="Build stage for the Vue Advanced Chat demo application" + +# Set working directory +WORKDIR /app + +# Copy package.json and package-lock.json (or yarn.lock) +# We copy these first to leverage Docker cache for dependencies +COPY package.json ./ +# Assuming npm is used because of package-lock.json in reset script +# The following line for package-lock.json is removed as per instructions +# COPY package-lock.json ./ + +# Install Python and C++ build tools +RUN apk add --no-cache python3 py3-setuptools make g++ + +# Install dependencies for the demo app +RUN npm install + +# Copy the rest of the demo application source code +COPY . . + +# Build the application +# The build script is "vite build" as found in demo/package.json +RUN npm run build + +# Stage 2: Serve the built application using Nginx +FROM nginx:stable-alpine AS serve-stage + +LABEL maintainer="Vue Advanced Chat Dev Team" +LABEL description="Serve stage for the Vue Advanced Chat demo application" + +# Copy built assets from the build stage +# Vite builds to a 'dist' directory by default +COPY --from=build-stage /app/dist /usr/share/nginx/html + +# Expose port 80 for Nginx +EXPOSE 80 + +# Start Nginx when the container launches +CMD ["nginx", "-g", "daemon off;"] diff --git a/demo/README.md b/demo/README.md new file mode 100644 index 00000000..af5e427b --- /dev/null +++ b/demo/README.md @@ -0,0 +1,25 @@ +# Demo Application + +This directory contains the demo application for `vue-advanced-chat`. + +## Running with Docker + +To build and run the demo application using Docker: + +1. **Navigate to the demo directory:** + Make sure you are in the `demo` directory of this project. + ```bash + cd path/to/your-project/demo + ``` + +2. **Build the Docker image:** + Run the following command from within the `demo` directory. The `.` specifies that the current directory (`demo/`) is the build context. + ```bash + docker build -t vue-advanced-chat-demo . + ``` + +3. **Run the Docker container:** + ```bash + docker run -p 8080:80 vue-advanced-chat-demo + ``` + This will start the demo application, and you can access it at [http://localhost:8080](http://localhost:8080) in your web browser. diff --git a/demo/index.html b/demo/index.html index c42abc5e..aa11a578 100644 --- a/demo/index.html +++ b/demo/index.html @@ -13,6 +13,7 @@ We're sorry but vue-advanced-chat doesn't work properly without JavaScript enabled. Please enable it to continue.
+