Add Dockerfile

This commit is contained in:
Correl Roush 2020-05-04 16:40:43 -04:00
parent dbe3ec4517
commit 62b2bc2484
2 changed files with 38 additions and 0 deletions

5
.dockerignore Normal file
View file

@ -0,0 +1,5 @@
_build
deps
assets/node_modules
assets/elm-stuff
test

33
Dockerfile Normal file
View file

@ -0,0 +1,33 @@
FROM elixir:1.10.3-alpine AS app_builder
ENV MIX_ENV=prod \
SECRET_KEY_BASE=secret-key-that-should-be-overriden-on-build
RUN apk add --update nodejs nodejs-npm \
&& mix local.hex --force \
&& mix local.rebar --force
COPY . /app
WORKDIR /app
RUN mix deps.get --only prod \
&& mix compile \
&& npm install --prefix ./assets \
&& npm run deploy --prefix ./assets \
&& mix phx.digest \
&& mix release
FROM alpine as app
EXPOSE 4000
RUN apk add --update openssl ncurses-libs \
&& rm -rf /var/cache/apk/*
RUN adduser -D -h /home/app app
WORKDIR /home/app
COPY --from=app_builder /app/_build/prod/rel/planningpoker .
RUN chown -R app: .
USER app
CMD ["bin/planningpoker", "start"]