-
Notifications
You must be signed in to change notification settings - Fork 48
/
dynamo.Dockerfile
32 lines (26 loc) · 1022 Bytes
/
dynamo.Dockerfile
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
ARG DB_LOCATION=/home/dynamodblocal/db
FROM amazon/dynamodb-local:2.5.2 AS install
USER root
RUN yum -y install awscli
USER dynamodblocal
ENV AWS_ACCESS_KEY_ID=GOSYNC
ENV AWS_SECRET_ACCESS_KEY=GOSYNC
ARG AWS_ENDPOINT=http://localhost:8000
ARG AWS_REGION=us-west-2
ARG DB_LOCATION
ARG TABLE_NAME=client-entity-dev
COPY schema/dynamodb/ .
RUN mkdir -p ${DB_LOCATION} && \
java -jar DynamoDBLocal.jar -sharedDb -dbPath ${DB_LOCATION} & \
DYNAMO_PID=$! && \
sleep 15 && \
aws dynamodb create-table --cli-input-json file://table.json \
--endpoint-url ${AWS_ENDPOINT} --region ${AWS_REGION} && \
aws dynamodb update-time-to-live --table-name client-entity-dev \
--time-to-live-specification "Enabled=true, AttributeName=ExpirationTime" \
--endpoint-url http://localhost:8000 && \
kill $DYNAMO_PID
FROM amazon/dynamodb-local:2.5.2
ARG DB_LOCATION
COPY --chown=dynamodblocal:dynamodblocal --from=install ${DB_LOCATION} /db
CMD ["-jar", "DynamoDBLocal.jar", "-sharedDb", "-dbPath", "/db"]