From 0a0b083e388b61f42dacab98e527f698d10eddf6 Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Thu, 26 Jul 2018 18:45:13 -0400 Subject: [PATCH] Codeship Pro --- Dockerfile | 29 +++++++++++++++++++++++++++++ codeship-services.yml | 17 +++++++++++++++++ codeship-steps.yml | 7 +++++++ config/test.exs | 4 +++- 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 codeship-services.yml create mode 100644 codeship-steps.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8db5774 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM elixir:1.6.0 + +ENV PHANTOMJS_VERSION 2.1.1 +ENV PHANTOMJS_DIR /phantomjs + +WORKDIR /phantomjs + +RUN wget -q --continue \ + "https://s3.amazonaws.com/codeship-packages/phantomjs-${PHANTOMJS_VERSION}-linux-x86_64.tar.bz2" +RUN tar -xjf phantomjs* \ + --strip-components=1 + +ENV PATH $PHANTOMJS_DIR/bin:$PATH + +WORKDIR /app + +RUN mix local.rebar --force && mix local.hex --force + +COPY mix.exs mix.lock ./ +RUN mix deps.get +RUN mix deps.compile + +WORKDIR /app/assets +COPY assets/ ./ +RUN yarn install && yarn run build + +WORKDIR /app + +COPY . ./ diff --git a/codeship-services.yml b/codeship-services.yml new file mode 100644 index 0000000..2e158d5 --- /dev/null +++ b/codeship-services.yml @@ -0,0 +1,17 @@ +app: + build: + image: danbee/chess + dockerfile: Dockerfile + depends_on: + - db + environment: + MIX_ENV: test + POSTGRES_HOST: db + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + +db: + image: healthcheck/postgres:alpine + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password diff --git a/codeship-steps.yml b/codeship-steps.yml new file mode 100644 index 0000000..7435aa8 --- /dev/null +++ b/codeship-steps.yml @@ -0,0 +1,7 @@ +- name: create_db + command: mix ecto.create ecto.migrate + service: app + +- name: mix_test + command: mix test + service: app diff --git a/config/test.exs b/config/test.exs index d3d5494..1e67acd 100644 --- a/config/test.exs +++ b/config/test.exs @@ -19,6 +19,8 @@ config :chess, Chess.Mailer, config :chess, Chess.Repo, adapter: Ecto.Adapters.Postgres, database: "chess_test", - hostname: "localhost", + hostname: System.get_env("POSTGRES_HOST") || "localhost", port: System.get_env("POSTGRES_PORT") || "5432", + username: System.get_env("POSTGRES_USER") || System.get_env("USER"), + password: System.get_env("POSTGRES_PASSWORD") || nil, pool: Ecto.Adapters.SQL.Sandbox