Last active
April 3, 2018 11:55
-
-
Save tiagopog/ec0e5cd7ea90261fdf8e029c86248daa to your computer and use it in GitHub Desktop.
Elixir - Deploy with mix_docker, Distillery, Docker and k8s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rel/config.exs | |
use Mix.Releases.Config, | |
default_release: :myapp, | |
default_environment: Mix.env | |
environment :dev do | |
set dev_mode: true | |
set include_erts: false | |
set include_system_libs: false | |
set cookie: :dev | |
end | |
environment :prod do | |
set include_erts: true | |
set include_system_libs: true | |
set cookie: :prod | |
end | |
# Regular app: | |
release :foo do | |
set version: current_version(:foo) | |
end | |
# Umbrella app: | |
release :myapp do | |
set version: "0.1.0" | |
set applications: [:app_a, app_b: :permanent, some_dep: :load] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM elixir:1.4.2 | |
ENV DEBIAN_FRONTEND=noninteractive | |
ENV HOME=/opt/app/ TERM=xterm | |
# Install Hex+Rebar | |
RUN mix local.hex --force && \ | |
mix local.rebar --force | |
WORKDIR /opt/app | |
ENV MIX_ENV=prod REPLACE_OS_VARS=true | |
# Cache elixir deps | |
COPY mix.exs mix.lock ./ | |
RUN mix deps.get | |
COPY config ./config | |
RUN mix deps.compile | |
COPY . . | |
RUN mix release --env=prod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM elixir:1.4.2 | |
ENV DEBIAN_FRONTEND=noninteractive | |
EXPOSE 8000 | |
ENV PORT=8000 MIX_ENV=prod REPLACE_OS_VARS=true SHELL=/bin/bash | |
WORKDIR /app | |
COPY ./myapp.tar.gz ./ | |
RUN tar xfz myapp.tar.gz | |
ENTRYPOINT ["bin/myapp"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment