diff options
| author | Mel <einebeere@gmail.com> | 2022-02-20 02:12:44 +0100 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2022-02-20 02:24:18 +0100 |
| commit | 930afe034a41bee7b0888d734317116eef221a64 (patch) | |
| tree | b20881f83f16f0255d4047d9620522c2ff8f9039 | |
| parent | 2eb214d74acb7f5cf4cb6271b30d6589192f7018 (diff) | |
| download | rook-930afe034a41bee7b0888d734317116eef221a64.tar.zst rook-930afe034a41bee7b0888d734317116eef221a64.zip | |
Create Docker setup
| -rw-r--r-- | Dockerfile | 42 | ||||
| -rw-r--r-- | config/prod.exs | 2 | ||||
| -rw-r--r-- | docker-compose.yml | 14 |
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 |
