From 3c43d552301a67c99d40db1c594baa986bd19964 Mon Sep 17 00:00:00 2001 From: Idhibhat Pankam Date: Sat, 29 Jun 2024 11:56:00 +0700 Subject: [PATCH] feat: docker-compose --- Makefile | 17 +++++++++ cmd/main.go | 1 - docker-compose.qa.yml | 84 +++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 33 +++++++++++++++++ 4 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 docker-compose.qa.yml create mode 100644 docker-compose.yml diff --git a/Makefile b/Makefile index 028056e..650d0b9 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,23 @@ +pull-latest-mac: + docker pull --platform linux/x86_64 ghcr.io/isd-sgcu/rpkm67-gateway:latest + docker pull --platform linux/x86_64 ghcr.io/isd-sgcu/rpkm67-auth:latest + docker pull --platform linux/x86_64 ghcr.io/isd-sgcu/rpkm67-backend:latest + docker pull --platform linux/x86_64 ghcr.io/isd-sgcu/rpkm67-checkin:latest + docker pull --platform linux/x86_64 ghcr.io/isd-sgcu/rpkm67-store:latest + +pull-latest-windows: + docker pull ghcr.io/isd-sgcu/rpkm67-gateway:latest + docker pull ghcr.io/isd-sgcu/rpkm67-auth:latest + docker pull ghcr.io/isd-sgcu/rpkm67-backend:latest + docker pull ghcr.io/isd-sgcu/rpkm67-checkin:latest + docker pull ghcr.io/isd-sgcu/rpkm67-store:latest + docker: docker-compose up +docker-qa: + docker-compose -f docker-compose.qa.yml up + server: go run cmd/main.go diff --git a/cmd/main.go b/cmd/main.go index b4dbbeb..d3ea55e 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -31,7 +31,6 @@ func main() { if err != nil { panic(fmt.Sprintf("Failed to load config: %v", err)) } - fmt.Println("conf: ", conf) logger := logger.New(conf) diff --git a/docker-compose.qa.yml b/docker-compose.qa.yml new file mode 100644 index 0000000..e06f4bd --- /dev/null +++ b/docker-compose.qa.yml @@ -0,0 +1,84 @@ +version: "3.9" + +services: + gateway: + image: ghcr.io/isd-sgcu/rpkm67-gateway:latest + container_name: gateway + restart: unless-stopped + environment: + APP_PORT: 3001 + APP_ENV: development + APP_MAX_FILE_SIZE_MB: 10 + CORS_ORIGINS: http://localhost:3000 + SERVICE_AUTH: auth:3002 + SERVICE_BACKEND: backend:3003 + SERVICE_CHECKIN: checkin:3004 + SERVICE_STORE: http://localhost:3005 + networks: + - rpkm67 + ports: + - "3001:3001" + + backend: + image: ghcr.io/isd-sgcu/rpkm67-backend:latest + container_name: backend + restart: unless-stopped + environment: + APP_PORT: 3003 + APP_ENV: development + DB_URL: postgres://root:1234@db:5432/rpkm67_db + REDIS_HOST: cache + REDIS_PORT: 6379 + REDIS_PASSWORD: 5678 + PIN_WORKSHOP_CODE: workshop + PIN_WORKSHOP_COUNT: 5 + PIN_LANDMARK_CODE: landmark + PIN_LANDMARK_COUNT: 4 + networks: + - rpkm67 + ports: + - "3003:3003" + + checkin: + image: ghcr.io/isd-sgcu/rpkm67-checkin:latest + container_name: checkin + restart: unless-stopped + environment: + APP_PORT: 3004 + APP_ENV: development + DB_URL: postgres://root:1234@db:5432/rpkm67_db + networks: + - rpkm67 + ports: + - "3004:3004" + + db: + image: postgres:15.1-alpine3.17 + container_name: db + restart: unless-stopped + environment: + POSTGRES_USER: root + POSTGRES_PASSWORD: "1234" + POSTGRES_DB: rpkm67_db + networks: + - rpkm67 + volumes: + - ./volumes/postgres:/var/lib/postgresql/data + ports: + - "5432:5432" + + cache: + image: redis:7.2.3-alpine + container_name: cache + restart: unless-stopped + environment: + REDIS_HOST: localhost + REDIS_PASSWORD: "5678" + networks: + - rpkm67 + ports: + - "6379:6379" + +networks: + rpkm67: + name: rpkm67 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..25dd95d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,33 @@ +version: "3.9" + +services: + db: + image: postgres:15.1-alpine3.17 + container_name: db + restart: unless-stopped + environment: + POSTGRES_USER: root + POSTGRES_PASSWORD: "1234" + POSTGRES_DB: rpkm67_db + networks: + - rpkm67 + volumes: + - ./volumes/postgres:/var/lib/postgresql/data + ports: + - "5432:5432" + + cache: + image: redis:7.2.3-alpine + container_name: cache + restart: unless-stopped + environment: + REDIS_HOST: localhost + REDIS_PASSWORD: "5678" + networks: + - rpkm67 + ports: + - "6379:6379" + +networks: + rpkm67: + name: rpkm67