Alternative Dockerfiles - Recruitee/mix_docker GitHub Wiki
There are many different ways to build docker containers with elixir apps.
Here is the community-driven list of alternative dockerfile pairs that are compatible with mix_docker two-phased flow.
In order to use them simply copy the content into Dockerfile.build
and Dockerfile.release
files in your project root directory.
Minimal images from @aeons
# Dockerfile.build
FROM aeons/elixir-gcc:1.4.1
ENV MIX_ENV=prod
WORKDIR /opt/app
COPY mix.exs mix.lock ./
RUN mix do deps.get, deps.compile
COPY . .
RUN mix release --env=prod --verbose
# Dockerfile.release
FROM alpine:3.5
RUN apk --no-cache add ncurses-libs
WORKDIR /opt/app/
EXPOSE 4000
ENV PORT=4000 MIX_ENV=prod REPLACE_OS_VARS=true
ADD ${APP}.tar.gz ./
RUN adduser -S default
RUN chown -R default .
USER default
ENTRYPOINT ["/opt/app/bin/${APP}"]