Browse Source

docker setup done

master
esoe 6 months ago
parent
commit
5216a670b9
  1. 16
      client-service-teachers/docker-compose.yaml
  2. 1
      docker-compose.yaml
  3. 5
      postgres-service/.env
  4. 34
      postgres-service/docker-compose.yaml
  5. 20
      postgres-service/dockerfile
  6. 16
      resource-service-api/docker-compose.yaml
  7. 2
      resource-service-api/dockerfile

16
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

1
docker-compose.yaml

@ -19,7 +19,6 @@ services:
postgres-service: postgres-service:
build: build:
context: postgres-service/ context: postgres-service/
# dockerfile: dockerfile
image: "postgres-service" image: "postgres-service"
container_name: ${PG_CONTAINER_NAME} container_name: ${PG_CONTAINER_NAME}
environment: environment:

5
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'

34
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

20
postgres-service/dockerfile

@ -1,7 +1,25 @@
FROM postgres:latest # Postgres-service start
ARG VERSION=latest
# Образ контейнера
FROM postgres:${VERSION}
# Сведения о контейнере
LABEL author="esoe" LABEL author="esoe"
LABEL description="postgres image for tech-services" LABEL description="postgres image for tech-services"
LABEL version="1.0" 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/ # COPY *.sql /docker-entrypoint-initdb.d/
# Сборка контейнера
# docker build
# Запуск контейнера
# docker run

16
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

2
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 WORKDIR /app
# ENTRYPOINT ["java","-jar","/app/resource-service-api-0.1.jar"] # ENTRYPOINT ["java","-jar","/app/resource-service-api-0.1.jar"]
# docker image build -t resource-service-api:latest . # docker image build -t resource-service-api:latest .
# docker run -p80:8181 resource-service-api:latest # docker run -d -p80:8181 resource-service-api:latest
Loading…
Cancel
Save