Skip to content

Instantly share code, notes, and snippets.

@bitwalker
Last active Mar 12, 2017
Embed
What would you like to do?
Example Dockerfile for a release
FROM bitwalker/alpine-erlang:latest
MAINTAINER Paul Schoenfelder <paulschoenfelder@gmail.com>
ENV REFRESHED_AT=2016-06-21 \
HOME=/opt/app/ \
MIX_ENV=prod \
TERM=xterm \
REPLACE_OS_VARS=true
EXPOSE 5000
WORKDIR ${HOME}
RUN \
echo "@edge http://nl.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
apk --no-cache --update add elixir@edge git && \
mix local.hex --force && \
mix local.rebar --force
COPY mix.exs mix.lock ./
RUN mix do deps.get, deps.compile
ENV APP_VERSION=0.1.0
COPY . .
RUN mix do compile, release --verbose --env=prod && \
mkdir -p /opt/myapp/log && \
cp rel/myapp/releases/$APP_VERSION/myapp.tar.gz /opt/myapp/ && \
cd /opt/myapp && \
tar -xzf myapp.tar.gz && \
rm myapp.tar.gz && \
rm -rf /opt/app/* && \
chmod -R 777 /opt/app && \
chmod -R 777 /opt/myapp
WORKDIR /opt/myapp
CMD ./bin/myapp foreground
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment