diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 0000000..be51561 --- /dev/null +++ b/Dockerfile.dev @@ -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"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3d6e25c --- /dev/null +++ b/Makefile @@ -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}' diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..17a4bfc --- /dev/null +++ b/docker-compose.yml @@ -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'