From fb05690d16b611c0946f79f58be3914b2f7d6e7e Mon Sep 17 00:00:00 2001 From: Idhibhat Pankam Date: Wed, 17 Jan 2024 00:00:37 +0700 Subject: [PATCH] feat: prod compose --- Dockerfile | 6 ----- docker-compose-prod.yaml | 56 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 docker-compose-prod.yaml diff --git a/Dockerfile b/Dockerfile index 707c676..77e3d24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,9 +16,6 @@ COPY . . # Build the application RUN go build -o server ./cmd/main.go -# Copy config files -COPY ./config ./config - # Adding the grpc_health_probe RUN GRPC_HEALTH_PROBE_VERSION=v0.3.1 && \ wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \ @@ -36,9 +33,6 @@ COPY --from=base /bin/grpc_health_probe ./ # Copy execute file COPY --from=base /app/server ./ -# Copy config files -COPY --from=base /app/config ./config - # Set ENV to production ENV GO_ENV production diff --git a/docker-compose-prod.yaml b/docker-compose-prod.yaml new file mode 100644 index 0000000..e5c18ee --- /dev/null +++ b/docker-compose-prod.yaml @@ -0,0 +1,56 @@ +version: "3" + +services: + auth: + container_name: johnjud-auth + restart: unless-stopped + build: . + ports: + - 3002:3002 + environment: + - APP_PORT=3004 + - APP_ENV=development + - APP_SECRET=secret + - DB_URL=postgres://root:root@johnjud-local-db:5432/johnjud_db + - JWT_SECRET=secret + - JWT_EXPIRES_IN=3600 + - JWT_REFRESH_TOKEN_TTL=604800 + - JWT_ISSUER=issuer + - JWT_RESET_TOKEN_TTL=900 + - REDIS_HOST=localhost + - REDIS_PORT=6379 + - REDIS_PASSWORD= + - AUTH_CLIENT_URL=http://localhost:3000 + - SENDGRID_API_KEY=api_key + - SENDGRID_NAME=johnjud + - SENDGRID_ADDRESS=johnjud@gmail.com + networks: + - johnjud + + local-db: + image: postgres:15.1-alpine3.17 + container_name: johnjud-local-db + restart: unless-stopped + environment: + POSTGRES_USER: root + POSTGRES_PASSWORD: root + POSTGRES_DB: johnjud_db + volumes: + - postgres:/var/lib/postgresql/data + ports: + - "5432:5432" + networks: + - johnjud + + cache: + image: redis + restart: unless-stopped + ports: + - "6379:6379" + networks: + - johnjud + +volumes: + postgres: +networks: + johnjud: \ No newline at end of file