-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
89 lines (84 loc) · 2.19 KB
/
Copy pathdocker-compose.yml
File metadata and controls
89 lines (84 loc) · 2.19 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
services:
# 1. Redis Cache
cache:
image: redis:alpine
ports:
- "6379:6379"
# 2. DynamoDB Local
dynamodb:
command: "-jar DynamoDBLocal.jar -sharedDb -inMemory"
image: "amazon/dynamodb-local:latest"
container_name: dynamodb-local
ports:
- "8000:8000"
working_dir: /home/dynamodblocal
# 3. Initialization container (Create DynamoDB table)
db-init:
image: amazon/aws-cli
environment:
- AWS_ACCESS_KEY_ID=local
- AWS_SECRET_ACCESS_KEY=local
- AWS_DEFAULT_REGION=us-east-1
depends_on:
- dynamodb
entrypoint: /bin/bash
command: >
-c "sleep 5 && aws dynamodb create-table --endpoint-url http://dynamodb:8000 --table-name UrlShortenerTable --attribute-definitions AttributeName=id,AttributeType=S --key-schema AttributeName=id,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 || true"
# 4. Lambda Functions
app-generate:
build:
context: .
args:
- FUNCTION=generate
ports:
- "8081:8080"
environment:
- LinkTableName=UrlShortenerTable
- DynamoDBEndpoint=http://dynamodb:8000
- RedisAddress=cache:6379
- RedisPassword=
- RedisDB=0
- AWS_ACCESS_KEY_ID=local
- AWS_SECRET_ACCESS_KEY=local
- AWS_REGION=us-east-1
depends_on:
- dynamodb
- cache
app-redirect:
build:
context: .
args:
- FUNCTION=redirect
ports:
- "8082:8080"
environment:
- LinkTableName=UrlShortenerTable
- DynamoDBEndpoint=http://dynamodb:8000
- RedisAddress=cache:6379
- RedisPassword=
- RedisDB=0
- AWS_ACCESS_KEY_ID=local
- AWS_SECRET_ACCESS_KEY=local
- AWS_REGION=us-east-1
depends_on:
- dynamodb
- cache
app-delete:
build:
context: .
args:
- FUNCTION=delete
ports:
- "8083:8080"
environment:
- LinkTableName=UrlShortenerTable
- DynamoDBEndpoint=http://dynamodb:8000
- RedisAddress=cache:6379
- RedisPassword=
- RedisDB=0
- AWS_ACCESS_KEY_ID=local
- AWS_SECRET_ACCESS_KEY=local
- AWS_REGION=us-east-1
depends_on:
- dynamodb
- cache