Skip to content

Instantly share code, notes, and snippets.

@oivoodoo
Created November 23, 2016 08:09
Show Gist options
  • Save oivoodoo/ff04dcede5052e6639c55e2f64deb950 to your computer and use it in GitHub Desktop.
Save oivoodoo/ff04dcede5052e6639c55e2f64deb950 to your computer and use it in GitHub Desktop.
Dockerize Elixir app
use Mix.Config
config :redis_poolex,
reconnect: :no_reconnect,
max_queue: :infinity,
pool_size: 10,
pool_max_overflow: 1,
connection_string: "redis://redis:6379/"
config :requesters, Requesters.Workers.RabbitConfig,
hostname: "amqp://rabbitmq:5672",
pool_size: 1,
max_overflow: 1,
reconnect_timeout: 5000
config :requesters, Requesters.Repo,
adapter: Ecto.Adapters.Postgres,
url: "postgres://postgres:mysecretpassword@db:5432/postgres"
config :tirexs, :uri, "http://elasticsearch:9200"
version: "2"
services:
elasticsearch:
image: elasticsearch:latest
container_name: elasticsearch
ports: ["9200"]
networks:
- back-tier
rabbitmq:
image: rabbitmq:latest
container_name: rabbitmq
ports: ["5672"]
networks:
- back-tier
redis:
image: redis:alpine
container_name: redis
ports: ["6379"]
networks:
- back-tier
db:
image: postgres:9.4
container_name: db
volumes:
- "db-data:/var/lib/postgresql/data"
networks:
- back-tier
volumes:
db-data:
networks:
back-tier:
FROM trenpixster/elixir
WORKDIR /app
ADD http://s3.amazonaws.com/s3.hex.pm/installs/1.1.0/hex-0.14.0.ez /tmp/
RUN mix archive.install --force /tmp/hex-0.14.0.ez
NAME = musicfeed-workers
build:
docker build -t $(NAME) .
docker run --rm -t -i \
--network=musicfeedworkers_back-tier \
-v `pwd`:/app \
--dns 8.8.8.8 \
-w /app \
$(NAME) \
/bin/bash -c "mix deps.get"
.PHONY: build
test:
docker run --rm -t -i \
--network=musicfeedworkers_back-tier \
-v `pwd`:/app \
--dns 8.8.8.8 \
-w /app \
$(NAME) \
/bin/bash -c "mix test"
.PHONY: test
console:
docker run --rm -t -i \
--network=musicfeedworkers_back-tier \
-v `pwd`:/app \
--dns 8.8.8.8 \
-w /app \
$(NAME) \
/bin/bash
.PHONY: console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment