it's my first time using Docker let alone docker-compose. Could I get some insight on my docker-compose file to help me get both docker containers up and running.
Folder Structure
Both of my Dockerfiles work for running each application ( React or Flask ) separately. For example:
React Container
docker build -t wedding-client .
docker run -dp 3030:3030 wedding-client
Flask Container
docker build -t wedding-server .
docker run -dp 5030:5030 wedding-server
So I'm thinking my docker-compose file is the issue. Here are the docker files:
client/DockerFile
FROM node:alpine as build
WORKDIR /app
COPY . /app
RUN npm install
RUN npm run build
FROM nginx:alpine
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
COPY --from=build /app/build .
COPY nginx/nginx.conf /etc/nginx/conf.d
EXPOSE 3030
CMD ["nginx", "-g", "daemon off;"]
server/DockerFile
FROM python:3.9
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt
ENV FLASK_APP server.py
EXPOSE 5030
CMD ["python", "server.py"]
docker-compose.yml
version: '3'
services:
server:
container_name: wedding-server
build:
context: server/
dockerfile: Dockerfile
network_mode: host
ports:
- 5030:5030
client:
container_name: wedding-client
build:
context: client/
dockerfile: Dockerfile
network_mode: host
ports:
- 3030:3030
depends_on:
- server
Docker Output:

