From 0592353ba6bcbbcfab20e8f965e658756b4ad47f Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sat, 27 May 2017 21:26:25 +0200 Subject: [PATCH] More fine grained COPY in Dockerfile --- .dockerignore | 1 + Dockerfile | 55 +++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/.dockerignore b/.dockerignore index f737316..2c9bc4b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,6 +7,7 @@ tmp/* log/* target uploads/* +public/uploads/* coverage volumes Dockerfile diff --git a/Dockerfile b/Dockerfile index a765c4b..21befaa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -117,35 +117,64 @@ COPY src /app/src COPY resources /app/resources RUN lein uberjar -# install hex packages - -COPY mix.* /app/ -RUN mix deps.get --only prod - -# install brunch & co - -COPY package.json /app/ -RUN npm install - -# copy the rest of the source code - -COPY . /app +# service URLs ENV DATABASE_URL "postgresql://postgres@postgres/postgres" ENV REDIS_URL "redis://redis:6379" # compile terminal.c +RUN mkdir -p /app/bin +COPY src/Makefile /app/src/ +COPY src/terminal.c /app/src/ RUN cd src && make +# add Ruby source files + +COPY config/*.rb /app/config/ +COPY config/*.yml /app/config/ +COPY config/environments /app/config/environments +COPY config/initializers /app/config/initializers +COPY config/locales /app/config/locales +COPY db /app/db +COPY lib/*.rb /app/lib/ +COPY lib/authentication /app/lib/authentication +COPY lib/tasks /app/lib/tasks +COPY public /app/public +COPY vendor /app/vendor +COPY config.ru /app/ +COPY Rakefile /app/ +COPY app /app/app + # compile assets with assets pipeline RUN bundle exec rake assets:precompile +# install hex packages + +COPY mix.* /app/ +RUN mix deps.get --only prod + +# install brunch & co + +COPY package.json /app/ +RUN npm install + # compile assets with brunch and generate digest file +COPY brunch-config.js /app/ +COPY web/static /app/web/static RUN node_modules/brunch/bin/brunch build --production && mix phoenix.digest +# add Elixir source files + +COPY config/*.exs /app/config/ +COPY lib/*.ex /app/lib +COPY lib/asciinema /app/lib/asciinema +COPY priv/gettext /app/priv/gettext +COPY priv/repo /app/priv/repo +COPY web /app/web + # compile Elixir app RUN mix compile