Skip to content

Add PostgreSQL database with docker #6

@MayuriXx

Description

@MayuriXx

Use PostgreSQL

The differents dependencies are in the pom.xml, just uncomment

Create one docker-compose.yml
for example :

version: '3.8'

services:
  postgres:
    image: postgres:15-alpine
    container_name: xpeho_postgres
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: xpeho_db
    ports:
      - "5433:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./src/main/resources/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql
      # INIT DATA
#      - ./src/main/resources/data.sql:/docker-entrypoint-initdb.d/02-data.sql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - xpeho_network

volumes:
  postgres_data:
    driver: local

networks:
  xpeho_network:
    driver: bridge


For create the database, you need one file schema.sql with the differents data :

  • gender
  • firstname = name.first
  • lastname = name.last
  • civility = name.title
  • email
  • phone
  • picture.medium -> so picture
  • nat

Add documentation in :

  • Github project
  • Bookstack
  • README for the task

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions