diff --git a/client-web/Dockerfile b/client-web/Dockerfile index cd6cc98..eb19b8a 100644 --- a/client-web/Dockerfile +++ b/client-web/Dockerfile @@ -3,26 +3,27 @@ FROM node:20-alpine AS build WORKDIR /app -# Copy package files -# We use the local package files to avoid workspace hoisting issues in Docker -COPY package.json ./ -# If there is a lockfile in apps/web, use it, otherwise use root (but root is workspace, so better not) -# Let's try to generate a clean install -RUN npm install --legacy-peer-deps +# Copy root package.json and lockfile if any +COPY package.json package-lock.json* ./ +COPY client-web/package.json ./client-web/ -# Copy source code -COPY . ./ +# Install dependencies specifically for client-web +RUN npm install + +# Copy source code and shared resources +COPY client-web/ ./client-web/ +COPY shared/ ./shared/ # Build web frontend -RUN npm run build +RUN cd client-web && npm run build # Stage 2: Serve with Nginx FROM nginx:alpine # Copy built assets -COPY --from=build /app/dist /usr/share/nginx/html +COPY --from=build /app/client-web/dist /usr/share/nginx/html -# Custom Nginx config to proxy /api and /socket.io to server:3001 +# Custom Nginx config from docker/ folder COPY docker/nginx/default.conf /etc/nginx/conf.d/default.conf EXPOSE 80 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index bcb0a8a..9c0afa1 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -48,8 +48,8 @@ services: web: build: - context: ../client-web - dockerfile: Dockerfile + context: .. + dockerfile: client-web/Dockerfile container_name: knot-web restart: always ports: