-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose-postgres-and-redis.yml
42 lines (39 loc) · 1.12 KB
/
docker-compose-postgres-and-redis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
services:
app:
build:
context: .
dockerfile: Dockerfile
container_name: link-converter-app
ports:
- "8080:8080"
environment:
SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL}
SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME}
SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD}
SPRING_REDIS_HOST: ${REDIS_HOST}
SPRING_REDIS_PORT: ${REDIS_PORT}
SPRING_PROFILES_ACTIVE: "postgres-redis"
depends_on:
- postgres
- redis
profiles: ["prod"]
postgres:
image: postgres:16.4-alpine
container_name: postgres
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "${POSTGRES_PORT}:${POSTGRES_PORT}"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./postgres-init.sql:/docker-entrypoint-initdb.d/postgres-init.sql
redis:
image: redis:7.4-alpine
container_name: redis
ports:
- "${REDIS_PORT}:${REDIS_PORT}"
command: redis-server --maxmemory 512mb --maxmemory-policy allkeys-lfu
volumes:
postgres_data: