Last active
January 31, 2019 01:16
-
-
Save rflaperuta/432b0d819dc22e02219d4ead18ab993f to your computer and use it in GitHub Desktop.
Elixir/Phoenix Dockerfile Alpine Multi-stage (w/ distillery)
This file contains hidden or 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.7.4-alpine AS builder | |
ARG MIX_ENV=prod | |
ENV MIX_ENV=${BUILD_ENV:-prod} | |
WORKDIR /opt/app | |
RUN apk add --update --upgrade --no-cache nodejs npm yarn git build-base \ | |
&& mix local.hex --force && mix local.rebar --force | |
COPY . . | |
RUN mix do deps.get, deps.compile, compile | |
RUN cd ./assets && npm install && npm run deploy && cd .. && mix phx.digest | |
RUN mkdir -p /opt/build \ | |
&& mix do release --env=${MIX_ENV} --verbose \ | |
&& cp _build/prod/rel/APLICACAO/releases/0.1.0/APLICACAO.tar.gz /opt/build \ | |
&& cd /opt/build \ | |
&& tar -xzf APLICACAO.tar.gz \ | |
&& rm APLICACAO.tar.gz | |
FROM erlang:21-alpine | |
ARG PORT=8080 | |
ENV PORT=$PORT | |
EXPOSE $PORT | |
HEALTHCHECK CMD wget -q -O /dev/null http://localhost:$PORT/health || exit 1 | |
WORKDIR /opt/app | |
RUN apk add --upgrade --update --no-cache bash inotify-tools postgresql-dev | |
COPY --from=builder /opt/build . | |
CMD ["/opt/app/bin/APLICACAO", "foreground"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Needs improvements...