Dockerize waku-frontend

This commit is contained in:
alrevuelta 2024-05-21 10:08:33 +02:00
parent a2b77b369d
commit 891c5be53f
No known key found for this signature in database
GPG Key ID: F345C9F3CCDB886E
3 changed files with 41 additions and 4 deletions

View File

@ -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"]

View File

@ -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
```

View File

@ -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: {