Skip to content

Commit

Permalink
#36 feat. Docker Compose로 로컬 DB 환경 구성
Browse files Browse the repository at this point in the history
  • Loading branch information
electronyoon committed Feb 11, 2025
1 parent 99ca209 commit c6538cb
Show file tree
Hide file tree
Showing 16 changed files with 93 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.zipsoon.common.domain.user;
package com.zipsoon.api.user.domain.user;

public enum Role {
USER,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.zipsoon.common.domain.user;
package com.zipsoon.api.user.domain.user;

import com.zipsoon.common.security.model.AuthProvider;
import lombok.Builder;
import lombok.Getter;
import org.springframework.security.crypto.password.PasswordEncoder;

import java.security.AuthProvider;
import java.time.LocalDateTime;

@Getter
Expand Down

This file was deleted.

13 changes: 0 additions & 13 deletions common/src/main/resources/application.yml

This file was deleted.

57 changes: 57 additions & 0 deletions docker-compose.local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
version: "3.9"

networks:
zipsoon-network:
driver: bridge

services:
db:
image: postgis/postgis:15-3.4
ports:
- "5432:5432"
environment:
- POSTGRES_DB=${LOCAL_DB_NAME}
- POSTGRES_USER=${LOCAL_DB_USERNAME}
- POSTGRES_PASSWORD=${LOCAL_DB_PASSWORD}
volumes:
- ./common/src/main/resources/init-users.sql:/docker-entrypoint-initdb.d/00-init-users.sql
- ./common/src/main/resources/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql
- ./batch/src/main/resources/schema/schema-postgresql.sql:/docker-entrypoint-initdb.d/02-schema-postgresql.sql
networks:
- zipsoon-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${LOCAL_DB_USERNAME} -d ${LOCAL_DB_NAME}"]
interval: 5s
timeout: 5s
retries: 5

batch:
environment:
- SPRING_PROFILES_ACTIVE=local
- SPRING_DATASOURCE_URL=${LOCAL_SPRING_DATASOURCE_URL}
- SPRING_DATASOURCE_USERNAME=${LOCAL_DB_USERNAME}
- SPRING_DATASOURCE_PASSWORD=${LOCAL_DB_PASSWORD}
- NAVER_LAND_BASE_URL=${NAVER_LAND_BASE_URL}
- NAVER_LAND_AUTH_TOKEN=${NAVER_LAND_AUTH_TOKEN}
networks:
- zipsoon-network
depends_on:
db:
condition: service_healthy

api:
ports:
- "8080:8080"
environment:
- SPRING_PROFILES_ACTIVE=local
- SPRING_DATASOURCE_URL=${LOCAL_SPRING_DATASOURCE_URL}
- SPRING_DATASOURCE_USERNAME=${LOCAL_DB_USERNAME}
- SPRING_DATASOURCE_PASSWORD=${LOCAL_DB_PASSWORD}
networks:
- zipsoon-network
depends_on:
db:
condition: service_healthy

#volumes:
# zipsoon-data:
21 changes: 21 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: "3.9"

services:
batch:
image: ${BATCH_IMAGE_REGISTRY}
environment:
- SPRING_PROFILES_ACTIVE=prod
- SPRING_DATASOURCE_URL=jdbc:postgresql://${PROD_DB_HOST}:${PROD_DB_PORT}/${PROD_DB_NAME}
- SPRING_DATASOURCE_USERNAME=${PROD_DB_USERNAME}
- SPRING_DATASOURCE_PASSWORD=${PROD_DB_PASSWORD}
- NAVER_LAND_BASE_URL=${NAVER_LAND_BASE_URL}
- NAVER_LAND_AUTH_TOKEN=${NAVER_LAND_AUTH_TOKEN}

api:
image: ${API_IMAGE_REGISTRY}
environment:
- SPRING_PROFILES_ACTIVE=prod
- SPRING_DATASOURCE_URL=jdbc:postgresql://${PROD_DB_HOST}:${PROD_DB_PORT}/${PROD_DB_NAME}
- SPRING_DATASOURCE_USERNAME=${PROD_DB_USERNAME}
- SPRING_DATASOURCE_PASSWORD=${PROD_DB_PASSWORD}

12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3.9"

services:
batch:
build:
context: .
dockerfile: batch/Dockerfile

api:
build:
context: .
dockerfile: api/Dockerfile

0 comments on commit c6538cb

Please sign in to comment.