This is my Dockerfile
FROM elixir:1.11-slim
RUN mkdir /app
COPY . /app
WORKDIR /app
# Install hex
RUN mix local.hex --force
#Install rebar
RUN mix local.rebar --force
#Get dependencies
RUN mix deps.get
#Run
RUN mix
This is my docker-compose.yml
version: "3.2"
services:
checker:
build:
context: .
environment:
MY_VAR: "hello"
restart: on-failure
Mix.exs:
defmodule StockAlert.MixProject do
use Mix.Project
def project do
[
app: :stock_alert,
version: "0.1.0",
elixir: "~> 1.11.0",
deps: deps()
]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[
mod: {StockAlert.Application, []},
extra_applications: [:elastix,:lager, :logger, :runtime_tools]
]
end
# Specifies your project dependencies.
#
# Type `mix help deps` for examples and options.
defp deps do
[
{:elastix, "~> 0.10.0"},
{:gettext, "~> 0.11"},
{:jason, "~> 1.0"},
{:websockex, "~> 0.4.2"},
{:poison, "~> 3.1"},
{:amqp, "~> 2.1"},
{:json, "~> 1.4"}
]
end
end
StockAlert.Application
defmodule StockAlert.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
require Logger
@registry :workers_registry
def start(_type, _args) do
mvar = System.get_env("MY_VAR")
Logger.info "MY_VAR-> #{mvar}"
end
def registry(), do: @registry
end


















