version: "3" services: server: image: spring build: context: . ports: - "9080:8080" networks: - springnet cap_drop: - ALL environment: - DOCKER_DEPLOYMENT_TYPE=deployment # restart: unless-stopped depends_on: - postgres postgres: image: postgres:14-alpine networks: - springnet volumes: - db-data:/var/lib/postgresql/14/ ports: - "127.0.0.1:5432:5432" environment: - POSTGRES_PASSWORD_FILE=/run/secrets/pg_pass_secret - POSTGRES_USER_FILE=/run/secrets/pg_user_secret - POSTGRES_INITDB_ARGS_FILE=/run/secrets/pg_initdb_args_secret - POSTGRES_DB_FILE=/run/secrets/pg_db_secret secrets: - pg_pass_secret - pg_user_secret - pg_initdb_args_secret - pg_db_secret # restart: unless-stopped networks: springnet: volumes: db-data: secrets: pg_pass_secret: file: ./postgres/pg_pass_secret pg_user_secret: file: ./postgres/pg_user_secret pg_initdb_args_secret: file: ./postgres/pg_initdb_args_secret pg_db_secret: file: ./postgres/pg_db_secret