Ad

Run Nginx In Dockerfile With Backend And Frontend Parallel

How can I run nginx in dockerfile with backend and frontend parallel?

This is for a new Linux server and I installed docker to run all service like nginx for backend and frontend.

Actually, I can run backend local with dockerfile but how to integrate with backend and frontend. Furthermore to run with server nginx ...

    version: "3"

networks:
  xukashopnet:
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 10.0.5.0/16
#       gateway: 10.0.5.1
services:
  xukashop-database:
    image: mysql:8
    container_name: xukashop-db
    ports:
      - "8091:3306"
      - "33061:33060"
    restart: always
    volumes:
      - ./db_data:/var/lib/mysql
      - .:/xukashop
    environment:
      - MYSQL_ROOT_PASSWORD=12345678
      - MYSQL_DATABASE=xukashop
      - MYSQL_USER=admin
      - MYSQL_PASSWORD=123456789
    networks:
      xukashopnet:
        ipv4_address: 10.0.5.2
  xukashop-api:
    build:
      context: ./
      dockerfile: Dockerfile
    environment:
      - XUKA_SHOP_DATABASE_HOST=10.0.5.2
      - XUKA_SHOP_DATABASE_PORT=3306
      - XUKA_SHOP_DATABASE_NAME=xukashop
      - XUKA_SHOP_DATABASE_USERNAME=admin
      - XUKA_SHOP_DATABASE_PASSWORD=123456789
    restart: always
    ports:
      - 8080:8080
    links:
      - xukashop-database
    depends_on:
      - xukashop-database
    volumes:
      - .:/xukashop
    stdin_open: true
    tty: true
    networks:
      xukashopnet:
        ipv4_address: 10.0.5.3
volumes:
  db_data:
Ad

Answer

Looks like you're not running any frontend code with that docker compose file, only your api and db. Can you run through this tutorial and let us know what the result is?

Ad
source: stackoverflow.com
Ad