From 5216a670b9d8ff95a89cf07ab4bd253838d8facf Mon Sep 17 00:00:00 2001 From: esoe Date: Mon, 20 May 2024 16:16:19 +0300 Subject: [PATCH] docker setup done --- client-service-teachers/docker-compose.yaml | 16 ++++++++++ docker-compose.yaml | 1 - postgres-service/.env | 5 +++ postgres-service/docker-compose.yaml | 34 +++++++++++++++++++++ postgres-service/dockerfile | 20 +++++++++++- resource-service-api/docker-compose.yaml | 16 ++++++++++ resource-service-api/dockerfile | 2 +- 7 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 client-service-teachers/docker-compose.yaml create mode 100644 postgres-service/.env create mode 100644 postgres-service/docker-compose.yaml create mode 100644 resource-service-api/docker-compose.yaml diff --git a/client-service-teachers/docker-compose.yaml b/client-service-teachers/docker-compose.yaml new file mode 100644 index 0000000..4be2f94 --- /dev/null +++ b/client-service-teachers/docker-compose.yaml @@ -0,0 +1,16 @@ +version: "3.7" +services: + client-service-teachers: + build: + context: ../client-service-teachers + dockerfile: dockerfile + image: "client-service-teachers" + command: ["java","-jar","/app/client-service-teachers-0.1.jar"] + ports: + - 80:8181 + restart: unless-stopped +networks: + default: + external: + name: tech_network + driver: bridge \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 44e3348..1468104 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -19,7 +19,6 @@ services: postgres-service: build: context: postgres-service/ - # dockerfile: dockerfile image: "postgres-service" container_name: ${PG_CONTAINER_NAME} environment: diff --git a/postgres-service/.env b/postgres-service/.env new file mode 100644 index 0000000..3c5d42d --- /dev/null +++ b/postgres-service/.env @@ -0,0 +1,5 @@ +PG_CONTAINER_NAME='postgres-service' +POSTGRES_USER='tech-services' +POSTGRES_PASSWORD='password' +POSTGRES_DB='tech-services' +PGDATA='/data/tech-services' \ No newline at end of file diff --git a/postgres-service/docker-compose.yaml b/postgres-service/docker-compose.yaml new file mode 100644 index 0000000..47e7b48 --- /dev/null +++ b/postgres-service/docker-compose.yaml @@ -0,0 +1,34 @@ +version: "3.7" +services: + postgres-service: + build: + context: ../postgres-service + dockerfile: dockerfile + image: "postgres-service" + container_name: ${PG_CONTAINER_NAME} + environment: + POSTGRES_DB: ${POSTGRES_DB} + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + PGDATA: ${PGDATA} + volumes: + - db_tech-services:${PGDATA} + - predb_tech-services:/var/lib/postgresql/data + ports: + - "5432:5432" + restart: unless-stopped +volumes: + db_tech-services: + external: true + predb_tech-services: + external: true +networks: + default: + external: + name: tech_network + driver: bridge + +# docker volume create db_tech-services +# docker volume create predb_tech-services +# docker network create tech_network +# docker-compose up \ No newline at end of file diff --git a/postgres-service/dockerfile b/postgres-service/dockerfile index 6c369b7..35f93ed 100644 --- a/postgres-service/dockerfile +++ b/postgres-service/dockerfile @@ -1,7 +1,25 @@ -FROM postgres:latest +# Postgres-service start +ARG VERSION=latest +# Образ контейнера +FROM postgres:${VERSION} + +# Сведения о контейнере LABEL author="esoe" LABEL description="postgres image for tech-services" LABEL version="1.0" +# Переменные среды контейнера +# ENV PG_CONTAINER_NAME='postgres-service' +# ENV POSTGRES_USER='tech-services' +# ENV POSTGRES_PASSWORD='password' +# ENV POSTGRES_DB='tech-services' +# ENV PGDATA='/data/tech-services' + # COPY *.sql /docker-entrypoint-initdb.d/ + +# Сборка контейнера +# docker build + +# Запуск контейнера +# docker run diff --git a/resource-service-api/docker-compose.yaml b/resource-service-api/docker-compose.yaml new file mode 100644 index 0000000..d592bad --- /dev/null +++ b/resource-service-api/docker-compose.yaml @@ -0,0 +1,16 @@ +version: "3.7" +services: + resource-service-api: + build: + context: ../resource-service-api + dockerfile: dockerfile + image: "resource-service-api" + command: ["java","-jar","/app/resource-service-api-0.1.jar"] + ports: + - 81:8181 + restart: unless-stopped +networks: + default: + external: + name: tech_network + driver: bridge \ No newline at end of file diff --git a/resource-service-api/dockerfile b/resource-service-api/dockerfile index c97fc75..ff0e89c 100644 --- a/resource-service-api/dockerfile +++ b/resource-service-api/dockerfile @@ -5,4 +5,4 @@ COPY target/resource-service-api-0.1.jar /app/resource-service-api-0.1.jar WORKDIR /app # ENTRYPOINT ["java","-jar","/app/resource-service-api-0.1.jar"] # docker image build -t resource-service-api:latest . -# docker run -p80:8181 resource-service-api:latest \ No newline at end of file +# docker run -d -p80:8181 resource-service-api:latest \ No newline at end of file