chore: added docker configuration for dev environment

This commit is contained in:
danilo silva 2020-08-03 19:17:56 +00:00
parent 06756188dc
commit 1fc7cc55d7
3 changed files with 50 additions and 0 deletions

21
Dockerfile.dev Normal file
View file

@ -0,0 +1,21 @@
FROM elixir:latest
# Set environment variables for building the application
ENV MIX_ENV=dev \
TEST=1 \
LANG=C.UTF-8
RUN apt-get update && \
apt-get install -y postgresql-client && \
apt-get install -y inotify-tools && \
apt-get install -y nodejs && \
curl -L https://npmjs.org/install.sh | sh && \
mix local.hex --force && \
mix archive.install hex phx_new 1.5.3 --force && \
mix local.rebar --force
# Create the application build directory
RUN mkdir /app
WORKDIR /app
CMD ["mix", "phx.server"]

13
Makefile Normal file
View file

@ -0,0 +1,13 @@
.PHONY: up
up: ## Start all the services
docker-compose up -d --remove-orphans
.PHONY: start
start: up ## Start openpod application
docker-compose exec open-pod iex -S mix phx.server
stop: ## Shoutdown services
docker-compose down -v
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

16
docker-compose.yml Normal file
View file

@ -0,0 +1,16 @@
version: '3.1'
services:
open-pod:
container_name: openpod
build:
context: ./
dockerfile: Dockerfile.dev
environment:
- MIX_ENV=dev
ports:
- '80:5000'
volumes:
- ./:/app
working_dir: /app
command: bash -c 'cd assets && npm i && npm rebuild node-sass && tail -f /dev/null'