I am trying to run my react frontend project on localhost:8000
with a docker-compose yml. And I am encountering a ERR_EMPTY_RESPONSE
Here is my docker-compose.yml
version: '3.8'
services:
app:
build: .
image: bookdup/website
depends_on:
- redis
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
ports:
- "8000:3000"
- "8001:8001"
networks:
website-demo:
aliases:
- website-server
volumes:
- .:/app
command: ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
redis:
image: redis:latest
container_name: redis
ports:
- "6379:6379"
networks:
- website-demo
networks:
website-demo:
Here is my DockerFile
# Use a suitable base image, e.g., Ubuntu
FROM ubuntu:latest
# Install necessary packages
RUN apt-get update &&
apt-get install -y nodejs npm python3 python3-pip python3-venv nginx supervisor
WORKDIR /app
COPY ./backend /app/backend
RUN pip install -r /app/backend/requirements.txt --break-system-packages
# Copy and install frontend requirements
COPY ./frontend /app/frontend
WORKDIR /app/frontend
# Update the start script in package.json
RUN sed -i 's/"start": "cross-env PORT=8000 react-scripts start"/"start": "react-scripts start"/' package.json
RUN npm install
# Set working directory back to root
WORKDIR /app
COPY credentials.json /app
COPY .env /app
COPY service.json /app
# Copy supervisord configuration
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Set environment variables
ENV PYTHONUNBUFFERED 1
# Command to run supervisord
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
I have tried two similar questions and none have worked for me
- localhost didn’t send any data. ERR_EMPTY_RESPONSE nodejs
- This page isn’t working localhost didn’t send any data. ERR_EMPTY_RESPONSE
Any help is appreciated
New contributor
Rapcole12 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.