Fix web docker context to support nginx config and shared sounds
This commit is contained in:
+12
-11
@@ -3,26 +3,27 @@ FROM node:20-alpine AS build
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy package files
|
# Copy root package.json and lockfile if any
|
||||||
# We use the local package files to avoid workspace hoisting issues in Docker
|
COPY package.json package-lock.json* ./
|
||||||
COPY package.json ./
|
COPY client-web/package.json ./client-web/
|
||||||
# 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 source code
|
# Install dependencies specifically for client-web
|
||||||
COPY . ./
|
RUN npm install
|
||||||
|
|
||||||
|
# Copy source code and shared resources
|
||||||
|
COPY client-web/ ./client-web/
|
||||||
|
COPY shared/ ./shared/
|
||||||
|
|
||||||
# Build web frontend
|
# Build web frontend
|
||||||
RUN npm run build
|
RUN cd client-web && npm run build
|
||||||
|
|
||||||
# Stage 2: Serve with Nginx
|
# Stage 2: Serve with Nginx
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
# Copy built assets
|
# 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
|
COPY docker/nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ services:
|
|||||||
|
|
||||||
web:
|
web:
|
||||||
build:
|
build:
|
||||||
context: ../client-web
|
context: ..
|
||||||
dockerfile: Dockerfile
|
dockerfile: client-web/Dockerfile
|
||||||
container_name: knot-web
|
container_name: knot-web
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
Reference in New Issue
Block a user