diff --git a/backend/Dockerfile b/backend/Dockerfile index 2854a57..7fe7d5f 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -6,11 +6,16 @@ WORKDIR /app # Install system dependencies for building Python packages RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ + g++ \ python3-dev \ + build-essential \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install dependencies COPY requirements.txt . +# Upgrade pip and setuptools first +RUN pip install --no-cache-dir --upgrade pip setuptools wheel +# Install dependencies with user flag RUN pip install --no-cache-dir --user -r requirements.txt # Production stage diff --git a/docker-compose.yml b/docker-compose.yml index c905968..389b23e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,6 +30,9 @@ services: build: context: ./frontend dockerfile: Dockerfile + args: + - NEXT_PUBLIC_API_URL=http://localhost:8000 + - NEXT_PUBLIC_WS_URL=ws://localhost:8000 container_name: bot-dashboard-frontend ports: - "3000:3000" diff --git a/frontend/Dockerfile b/frontend/Dockerfile index e5402db..77b35fd 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -16,6 +16,14 @@ COPY . . ENV NEXT_TELEMETRY_DISABLED 1 ENV NODE_ENV production +# Accept build arguments for API URLs +ARG NEXT_PUBLIC_API_URL=http://localhost:8000 +ARG NEXT_PUBLIC_WS_URL=ws://localhost:8000 + +# Set environment variables for Next.js build +ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL +ENV NEXT_PUBLIC_WS_URL=$NEXT_PUBLIC_WS_URL + # Build the application RUN npm run build @@ -46,4 +54,8 @@ EXPOSE 3000 ENV PORT 3000 ENV HOSTNAME "0.0.0.0" +# Runtime environment variables (can be overridden by docker-compose) +ENV NEXT_PUBLIC_API_URL=http://localhost:8000 +ENV NEXT_PUBLIC_WS_URL=ws://localhost:8000 + CMD ["node", "server.js"]