diff --git a/Dockerfile b/Dockerfile index d8448df..2bdccf3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,27 @@ -FROM httpd:2.4 -RUN mkdir -p /usr/local/apache2/htdocs/_next -COPY out/* /usr/local/apache2/htdocs/ -COPY out/_next /usr/local/apache2/htdocs/_next +# Use an official Node.js runtime as a parent image +FROM node:18-alpine + +# Set the working directory in the container +WORKDIR /app + +# Copy package.json and package-lock.json +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the application code +COPY . . + +# Install Vite globally (optional if not using npx or npm run dev directly) +RUN npm install -g vite + +# Expose the port Vite runs on +EXPOSE 5173 + +# Ensure node_modules/.bin is in the PATH +ENV PATH /app/node_modules/.bin:$PATH + +# Run the Vite development server +CMD ["npm", "run", "dev"] + diff --git a/README.md b/README.md index ff4b4ef..51b468f 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,22 @@ The public chat room is open to everyone who knows the community name. The conte ## Development +### Locally ```shell npm install npm run dev ``` +### Docker + +``` +docker build -t waku-frontend . +docker run -p 5173:5173 waku-frontend +``` + +And go to `http://localhost:5173`. + ## Caddy configuration ``` diff --git a/vite.config.ts b/vite.config.ts index 886aed5..2213f69 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,6 +4,10 @@ import react from '@vitejs/plugin-react' // https://vitejs.dev/config/ export default defineConfig({ + server: { + host: "0.0.0.0", + port: 5173, + }, plugins: [react()], resolve: { alias: {