Browse Source

chore: added docker configuration for dev environment

danilo silva 3 years ago
parent
commit
1fc7cc55d7
3 changed files with 50 additions and 0 deletions
  1. 21 0
      Dockerfile.dev
  2. 13 0
      Makefile
  3. 16 0
      docker-compose.yml

+ 21 - 0
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"]

+ 13 - 0
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}'

+ 16 - 0
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'