Skip to content
Permalink
Browse files

Add Dockerfile

  • Loading branch information...
picandocodigo committed Dec 13, 2017
1 parent 41901e1 commit 34a8f577c07932d6b66bdc6a4b068f2444292c0d
Showing with 60 additions and 0 deletions.
  1. +60 −0 Dockerfile
@@ -0,0 +1,60 @@
# Alias this container as builder:
FROM bitwalker/alpine-elixir-phoenix as builder

WORKDIR /paraguas

ENV MIX_ENV=prod

# Umbrella
COPY mix.exs mix.lock ./
COPY config config

# Our Greeter App
COPY apps/greeter/config apps/greeter/config/
COPY apps/greeter/mix.exs apps/greeter/

# Phoenix App
COPY apps/phoenix_app/mix.exs apps/phoenix_app/
COPY apps/phoenix_app/config apps/phoenix_app/config/

RUN mix do deps.get, deps.compile

COPY apps apps

# Build assets in production mode:
WORKDIR /paraguas/apps/phoenix_app/assets
RUN npm install && ./node_modules/brunch/bin/brunch build --production

WORKDIR /paraguas/apps/phoenix_app
RUN MIX_ENV=prod mix phx.digest

WORKDIR /paraguas
COPY rel rel
RUN mix release --env=prod --verbose

### Release

FROM alpine:3.6

RUN apk upgrade --no-cache && \
apk add --no-cache bash openssl
# we need bash and openssl for Phoenix

EXPOSE 4000

ENV PORT=4000 \
MIX_ENV=prod \
REPLACE_OS_VARS=true \
SHELL=/bin/bash

WORKDIR /paraguas

COPY --from=builder /paraguas/_build/prod/rel/paraguas/releases/0.1.0/paraguas.tar.gz .

RUN tar zxf paraguas.tar.gz && rm paraguas.tar.gz

RUN chown -R root ./releases

USER root

CMD ["/paraguas/bin/paraguas", "foreground"]

0 comments on commit 34a8f57

Please sign in to comment.
You can’t perform that action at this time.