Skip to content

Instantly share code, notes, and snippets.

@Voronchuk
Last active July 12, 2016 16:51
Show Gist options
  • Save Voronchuk/b1112e09b0ab4b8258b842b792a386cf to your computer and use it in GitHub Desktop.
Save Voronchuk/b1112e09b0ab4b8258b842b792a386cf to your computer and use it in GitHub Desktop.
Phoenix 1.1.6 on Elixir 1.2.5 and OTP 18
FROM erlang:18
MAINTAINER Vyacheslav Voronchuk <voronchuk@gmail.com>
# elixir expects utf8.
ENV ELIXIR_VERSION="v1.2.5" \
LANG=C.UTF-8
RUN set -xe \
&& ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/releases/download/${ELIXIR_VERSION}/Precompiled.zip" \
&& ELIXIR_DOWNLOAD_SHA256="4ab860707040e2dde4024cc8c0f74f1adc48aaae8d48293bf2b98fda3921a99c"\
&& buildDeps=' \
unzip \
' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& curl -fSL -o elixir-precompiled.zip $ELIXIR_DOWNLOAD_URL \
&& echo "$ELIXIR_DOWNLOAD_SHA256 elixir-precompiled.zip" | sha256sum -c - \
&& unzip -d /usr/local elixir-precompiled.zip \
&& rm elixir-precompiled.zip \
&& apt-get purge -y --auto-remove $buildDeps \
&& rm -rf /var/lib/apt/lists/*
# Setup Node - Phoenix uses the Node library `brunch` to compile assets.
# The official node instructions want you to pipe a script from the
# internet through sudo. There are alternatives:
# https://www.joyent.com/blog/installing-node-and-npm
RUN curl -sL https://deb.nodesource.com/setup_5.x | bash - && apt-get install -y nodejs
# Phoenix
ARG MIX_ENV=prod
ENV MIX_ENV $MIX_ENV
RUN mix local.hex --force && mix local.rebar
RUN mix archive.install --force https://github.com/phoenixframework/archives/raw/master/phoenix_new-1.1.6.ez
WORKDIR /var/app
# Software
COPY mix.exs /var/app/mix.exs
COPY mix.lock /var/app/mix.lock
COPY config /var/app/config
COPY lib /var/app/lib
COPY priv /var/app/priv
COPY web /var/app/web
RUN mix deps.get && mix deps.compile
RUN mix phoenix.digest
# Install Node Deps
COPY brunch-config.js /var/app/brunch-config.js
ADD package.json /var/app/package.json
RUN npm install
ENTRYPOINT ["mix", "phoenix.server"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment