From 88bd7a623143d8c6f8e15ee3a6d4e76c63595148 Mon Sep 17 00:00:00 2001 From: Alek Ratzloff Date: Tue, 18 Aug 2020 15:17:53 -0700 Subject: [PATCH] Add Dockerfile, docker-compose.yml, and docker.env Omnibot can be run using Docker and docker-compose using the provided files. Signed-off-by: Alek Ratzloff --- Dockerfile | 26 ++++++++++++++++++++++++++ docker-compose.yml | 13 +++++++++++++ docker.env | 2 ++ 3 files changed, 41 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 docker.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b7e4e27 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM elixir:1.10 + +# XXX # +# Rust is required because of the "meeseeks" dependency because it uses a Rust +# library for some reason. I'll start looking for alternatives so we don't have +# to worry about installing it in the future because that is not a small +# dependency. + +# It's impossible to pass a command line parameter (-y) to a shell script being +# read through stdin, so this line downloads, runs, and removes that script. +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh && \ + chmod +x /tmp/rustup.sh && \ + /tmp/rustup.sh -y && \ + rm /tmp/rustup.sh + +# Also set the PATH to include /root/.cargo/bin, where Rust was installed to +ENV PATH="/root/.cargo/bin:$PATH" + +# END XXX # + +RUN mkdir /app +WORKDIR /app + +RUN mix local.hex --force + +CMD mix run --no-halt diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..66f9466 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: "3.8" +services: + omnibot: + #image: "elixir:1.10" + build: . + #environment: + #MIX_ENV: prod + env_file: docker.env + volumes: + - ".:/app" + working_dir: "/app" + restart: always + #entrypoint: "mix local.hex --force; mix run --no-halt" diff --git a/docker.env b/docker.env new file mode 100644 index 0000000..570dbde --- /dev/null +++ b/docker.env @@ -0,0 +1,2 @@ +MIX_ENV=prod +OMNIBOT_CONFIG="omnibot.exs"