diff --git a/Dockerfile b/Dockerfile index bd6aadb52f0bf8b70fcd0ed74046dc42d446a40a..ce40468688183a2e074c5e5c0efa7a50a952d65e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,8 +33,6 @@ RUN mix local.hex --force && \ # set build ENV ENV MIX_ENV="prod" -ENV DATABASE_URL = "ecto://USER:PASS@HOST/DATABASE" -ENV SECRET_KEY_BASE = zYRQiZHSoacOEgsM9w0dW4YgMQeIOrHjlM63tkAdlTlHG6lXiCrkls2TD6khDliA # install mix dependencies COPY mix.exs mix.lock ./ @@ -86,11 +84,20 @@ RUN chown nobody /app # set runner ENV ENV MIX_ENV="prod" +#ENV DATABASE_URL="ecto://USER:PASS@HOST/DATABASE" +#ENV SECRET_KEY_BASE=zYRQiZHSoacOEgsM9w0dW4YgMQeIOrHjlM63tkAdlTlHG6lXiCrkls2TD6khDliA +#ENV PHX_SERVER=true +#ENV PHX_HOST="localhost" +#ENV PORT=4000 + # Only copy the final release from the build stage COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/nemo_cloud_services ./ USER nobody +EXPOSE 4000 + + # If using an environment that doesn't automatically reap zombie processes, it is # advised to add an init process such as tini via `apt-get install` # above and adding an entrypoint. See https://github.com/krallin/tini for details diff --git a/config/runtime.exs b/config/runtime.exs index ff92333860510f4b83914c4b731d3842c4935e96..611c0d2a5c6028976c73e502228eacc848d43abc 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -60,10 +60,12 @@ if config_env() == :prod do # Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access. # See the documentation on https://hexdocs.pm/bandit/Bandit.html#t:options/0 # for details about using IPv6 vs IPv4 and loopback vs public addresses. - ip: {0, 0, 0, 0, 0, 0, 0, 0}, - port: port + ip: {0, 0, 0, 0}, + port: port, ], - secret_key_base: secret_key_base + secret_key_base: secret_key_base, + server: true, + check_origin: false # ## SSL Support # diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..49956bbdf9e8cfa3c79ee7650e7ff3415ff7f8d3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + nemo_cloud_service: + build: . + container_name: "nemo_cloud_service_app" + + # Publish port 4000 directly to your host + ports: + - "4000:4000" + + environment: + - PHX_SERVER=true + - PORT=4000 + - MIX_ENV=prod + - DATABASE_URL= "ecto://user:pass@localhost/krendb" + - SECRET_KEY_BASE=zYRQiZHSoacOEgsM9w0dW4YgMQeIOrHjlM63tkAdlTlHG6lXiCrkls2TD6khDliA + - PHX_HOST=0.0.0.0 + +networks: + default: + driver: bridge \ No newline at end of file