From 62b2bc2484bd8c092535a2bc51a3a8380a833203 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Mon, 4 May 2020 16:40:43 -0400 Subject: [PATCH] Add Dockerfile --- .dockerignore | 5 +++++ Dockerfile | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..fc55df5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +_build +deps +assets/node_modules +assets/elm-stuff +test diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..74e1b7e --- /dev/null +++ b/Dockerfile @@ -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"]