Last active
September 23, 2024 22:37
-
-
Save borischerkasky/967970bc52d65cdb432b35c066496bf3 to your computer and use it in GitHub Desktop.
localstack docker compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
localstack: | |
image: localstack/localstack | |
ports: | |
- "4568-4576:4568-4576" | |
- "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}" | |
environment: | |
- DOCKER_HOST=unix:///var/run/docker.sock | |
- SERVICES=dynamodb:4569,kinesis:4568,sqs:4576 | |
- DEFAULT_REGION=us-east-1 | |
volumes: | |
- "/var/run/docker.sock:/var/run/docker.sock" | |
- "/private${TMPDIR}:/tmp/localstack" | |
networks: | |
- my_awesome_network | |
setup-resources: | |
image: mesosphere/aws-cli | |
volumes: | |
- ./dev_env:/project/dev_env | |
environment: | |
- AWS_ACCESS_KEY_ID=dummyaccess | |
- AWS_SECRET_ACCESS_KEY=dummysecret | |
- AWS_DEFAULT_REGION=us-east-1 | |
entrypoint: /bin/sh -c | |
command: > | |
" | |
# Needed so all localstack components will startup correctly (i'm sure there's a better way to do this) | |
sleep 10; | |
aws dynamodb create-table --endpoint-url=http://localstack:4569 --table-name my_table \ | |
--attribute-definitions AttributeName=key,AttributeType=S \ | |
--key-schema AttributeName=key,KeyType=HASH \ | |
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5; | |
aws kinesis create-stream --endpoint-url=http://localstack:4568 --stream-name my_stream --shard-count 1; | |
aws sqs create-queue --endpoint-url=http://localstack:4576 --queue-name my_queue; | |
# you can go on and put initial items in tables... | |
" | |
networks: | |
- my_awesome_network | |
depends_on: | |
- localstack | |
networks: | |
my_awesome_network: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment