about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile42
-rw-r--r--config/prod.exs2
-rw-r--r--docker-compose.yml14
3 files changed, 57 insertions, 1 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..32b9e6c
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,42 @@
+FROM elixir:latest AS elixir-deps
+WORKDIR /rook
+
+RUN mix local.hex --force
+RUN mix local.rebar --force
+
+ENV MIX_ENV=prod
+
+COPY mix.exs mix.lock ./
+RUN mix deps.get --only prod
+RUN mix ua_inspector.download --force
+RUN mix deps.compile
+
+FROM node:latest AS node
+WORKDIR /rook/assets
+
+# Needed for phoenix.js
+COPY --from=elixir-deps /rook/deps ../deps
+COPY assets/package.json ./
+COPY assets/yarn.lock ./
+
+RUN yarn install
+
+COPY assets ./
+RUN yarn deploy
+
+FROM elixir-deps AS elixir
+WORKDIR /rook
+ARG SECRET_KEY_BASE
+
+COPY config config
+COPY lib lib
+
+COPY --from=node /rook/priv priv
+RUN mix phx.digest
+
+COPY --from=elixir-deps /rook ./
+RUN mix do compile
+
+ENV MIX_ENV=prod
+ENV SECRET_KEY_BASE=$SECRET_KEY_BASE
+CMD ["mix", "phx.server"]
\ No newline at end of file
diff --git a/config/prod.exs b/config/prod.exs
index e9c44da..79eaa5f 100644
--- a/config/prod.exs
+++ b/config/prod.exs
@@ -10,7 +10,7 @@ use Mix.Config
 # which you should run after static files are built and
 # before starting your production server.
 config :rook, RookWeb.Endpoint,
-  url: [host: "example.com", port: 80],
+  url: [host: "rook.to", port: 80],
   cache_static_manifest: "priv/static/cache_manifest.json"
 
 # Do not print debug messages in production
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..8ce0c56
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,14 @@
+version: "3.7"
+
+services:
+  rook:
+    build: 
+      context: .
+      args:
+        - SECRET_KEY_BASE=$SECRET_KEY_BASE
+    container_name: rook
+    ports:
+      - "127.0.0.1:$PORT:$PORT"
+    environment:
+      - SECRET_KEY_BASE
+      - PORT