Skip to content
Snippets Groups Projects
Commit f70da85f authored by Ahmad Nadil's avatar Ahmad Nadil
Browse files

feat: redis on docker

parent a860a7d2
No related merge requests found
# Use the official Node.js image as the base image FROM node:21-alpine
FROM node:21.1.0
# Set the working directory in the container
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./
COPY yarn.lock ./
COPY ./prisma/schema.prisma ./prisma/ COPY ./prisma/schema.prisma ./prisma/
COPY .env ./ COPY .env ./
......
services: services:
rest-service-db: rest-service-db:
image: postgres:latest image: postgres:16-alpine
restart: always restart: always
ports: ports:
- 5432:5432 - 5432:5432
...@@ -11,8 +11,13 @@ services: ...@@ -11,8 +11,13 @@ services:
volumes: volumes:
- "./prisma/migrations/db:/docker-entrypoint-initdb.d" - "./prisma/migrations/db:/docker-entrypoint-initdb.d"
redis:
image: redis:7-alpine
ports:
- "6379:6379"
command: redis-server
rest-service: rest-service:
image: node:latest
build: build:
context: ../rest-service context: ../rest-service
dockerfile: Dockerfile dockerfile: Dockerfile
...@@ -21,3 +26,4 @@ services: ...@@ -21,3 +26,4 @@ services:
restart: always restart: always
depends_on: depends_on:
- rest-service-db - rest-service-db
- redis
...@@ -5,7 +5,7 @@ dotenv.config() ...@@ -5,7 +5,7 @@ dotenv.config()
export const client = createClient({ export const client = createClient({
socket: { socket: {
host: "127.0.0.1", host: process.env.REDIS_HOST,
port: 6379 port: Number(process.env.REDIS_PORT)
} }
}) })
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment