Skip to content

Instantly share code, notes, and snippets.

@bitwalker
Last active March 12, 2017 03:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitwalker/6d807905ce9e43065f0f42a86c0f0526 to your computer and use it in GitHub Desktop.
Save bitwalker/6d807905ce9e43065f0f42a86c0f0526 to your computer and use it in GitHub Desktop.
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