docker-compose.yaml

mail@pastecode.io avatar
unknown
yaml
a year ago
3.0 kB
1
Indexable
Never
#Это docker-compose.yaml
#После того, как мы собрали образ из Dockerfile командой 
#docker build -t my_docker .
#Мы можем проверить работу сервисов с базой данных.
#Запускаем командой 
#docker-compose run --rm  -p 8080:8080 ylavka-container
version: "2.3"

services:
    postgres:
        container_name: service-postgres
        image: postgres:15.2-alpine
        environment:
          - POSTGRES_DB=enrollment_template_db-1
          - POSTGRES_USER=user
          - POSTGRES_PASSWORD=password
        ports:
          - 5432
        volumes:
          - ./postgresql/schemas:/docker-entrypoint-initdb.d
          - ./.pgdata:/var/lib/postgresql/data
        networks:
          - postgres

    enrollment_template-container:
        image: ghcr.io/userver-framework/docker-userver-build-base:v1a
        privileged: true
        environment:
          - POSTGRES_DB=enrollment_template_db-1
          - POSTGRES_USER=user
          - POSTGRES_PASSWORD=password
          - PREFIX=${PREFIX:-~/.local}
          - CC
          - CCACHE_DIR=/enrollment_template/.ccache
          - CCACHE_HASHDIR
          - CCACHE_NOHASHDIR
          - CCACHE_PREFIX
          - CCACHE_SIZE
          - CMAKE_OPTS
          - CORES_DIR=/cores
          - CXX
          - MAKE_OPTS
        volumes:
          - .:/enrollment_template:rw
          - ./third_party/userver/tools/docker:/tools:ro
          - ${TC_CORES_DIR:-./.cores}:/cores:rw
        ports:
          - 8080:8080
        working_dir: /enrollment_template
        entrypoint:
          - /tools/run_as_user.sh
        depends_on:
          - postgres
        networks:
          - postgres


    postgres-release:
        container_name: db
        image: postgres:15.2-alpine
        environment:
          - POSTGRES_DB=postgres
          - POSTGRES_USER=postgres
          - POSTGRES_PASSWORD=password
        ports:
          - 5432
        volumes:
          - ./postgresql/schemas:/docker-entrypoint-initdb.d
          - ./.pgdata:/var/lib/postgresql/data
        networks:
          - postgres-release

    ylavka-container:
        image: my_docker
        privileged: true
        environment:
          - POSTGRES_DB=postgres
          - POSTGRES_USER=postgres
          - POSTGRES_PASSWORD=password
          - PREFIX=${PREFIX:-~/.local}
          - CC
          - CCACHE_DIR=/enrollment_template/.ccache
          - CCACHE_HASHDIR
          - CCACHE_NOHASHDIR
          - CCACHE_PREFIX
          - CCACHE_SIZE
          - CMAKE_OPTS
          - CORES_DIR=/cores
          - CXX
          - MAKE_OPTS
        volumes:
          - ${TC_CORES_DIR:-./.cores}:/cores:rw
        ports:
          - 8080:8080
        working_dir: /enrollment_template
        entrypoint:
          - /tools/run_as_user.sh
        depends_on:
          - postgres-release
        networks:
          - postgres-release

networks:
    postgres:
        driver: bridge
    postgres-release:
        driver: bridge