diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..ff7e19c39 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM elixir:1.6 + +RUN apt-get update && apt-get install -y build-essential inotify-tools postgresql-client + +RUN mix local.hex --force && mix local.rebar --force + +COPY docker/entrypoint.sh /bin/entrypoint + +WORKDIR /app + +EXPOSE 4000 \ No newline at end of file diff --git a/config/dev.exs b/config/dev.exs index 619571a42..6fecc0481 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -47,15 +47,14 @@ config :logger, :console, format: "[$level] $message\n", level: :debug # in production as building large stacktraces may be expensive. config :phoenix, :stacktrace_depth, 20 -config :eventos, Eventos.Mailer, - adapter: Bamboo.LocalAdapter +config :eventos, Eventos.Mailer, adapter: Bamboo.LocalAdapter # Configure your database config :eventos, Eventos.Repo, adapter: Ecto.Adapters.Postgres, types: Eventos.PostgresTypes, - username: "elixir", - password: "elixir", - database: "eventos_dev", - hostname: "localhost", + username: System.get_env("POSTGRES_USER") || "elixir", + password: System.get_env("POSTGRES_PASSWORD") || "elixir", + database: System.get_env("POSTGRES_DATABASE") || "eventos_dev", + hostname: System.get_env("POSTGRES_HOST") || "localhost", pool_size: 10 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..0237d3f91 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,38 @@ +version: '3' + +services: + + postgres: + container_name: eventos_db + restart: unless-stopped + image: mdillon/postgis:10 + environment: + POSTGRES_PASSWORD: postgres + POSTGRES_DB: eventos_dev + + front: + container_name: eventos_front + restart: unless-stopped + build: ./js + volumes: + - './js:/app/js' + ports: + - "80:8080" + entrypoint: entrypoint + + api: + container_name: eventos_api + restart: unless-stopped + build: . + volumes: + - '.:/app' + ports: + - "4000:4000" + depends_on: + - postgres + environment: + POSTGRES_PASSWORD: postgres + POSTGRES_USER: postgres + POSTGRES_DATABASE: eventos_dev + POSTGRES_HOST: postgres + entrypoint: entrypoint diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 000000000..7e1264472 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +mix deps.get + +# Wait for Postgres to become available. +until PGPASSWORD=$POSTGRES_PASSWORD psql -h postgres -U "postgres" -c '\q' 2>/dev/null; do + >&2 echo "Postgres is unavailable - sleeping" + sleep 1 +done + +echo "\nPostgres is available: continuing with database setup..." + +# Potentially Set up the database +mix ecto.create +mix ecto.migrate + +echo "\nTesting the installation..." +# "Proove" that install was successful by running the tests +mix test + +echo "\n Launching Phoenix web server..." +iex -S mix phx.server \ No newline at end of file diff --git a/js/Dockerfile b/js/Dockerfile new file mode 100644 index 000000000..55c74eded --- /dev/null +++ b/js/Dockerfile @@ -0,0 +1,9 @@ +FROM node:10 + +LABEL maintainer="tcit" + +COPY docker/entrypoint.sh /bin/entrypoint + +WORKDIR /app/js + +EXPOSE 8080 \ No newline at end of file diff --git a/js/docker/entrypoint.sh b/js/docker/entrypoint.sh new file mode 100755 index 000000000..304174648 --- /dev/null +++ b/js/docker/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +npm install +npm rebuild node-sass +npm run serve \ No newline at end of file diff --git a/js/src/App.vue b/js/src/App.vue index 24816741b..70cb7fd6f 100644 --- a/js/src/App.vue +++ b/js/src/App.vue @@ -9,22 +9,48 @@ enable-resize-watcher > - - - - - + + + + + + - - {{ this.displayed_name }} - - + + {{ this.displayed_name }} + + + + + + + + + + Autre identité + + + + + + group + + + Identities + + +