From 8ea74a21b0afe688c20b45d7eeafdfaec8d2d999 Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Thu, 28 Nov 2019 23:34:21 +0530 Subject: [PATCH] Fix docker file to use rails_env=production on precompile (#315) * Fix docker file to use rails_env=production on precompile * Fix docker file for prod deployment --- .dockerignore | 11 +++++++++++ docker-compose.yaml | 1 + docker/Dockerfile | 6 ++++-- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..1ed31c713 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +.bundle +.env +.env.* +public/system +public/assets +public/packs +node_modules +vendor/bundle +.DS_Store +*.swp +*~ diff --git a/docker-compose.yaml b/docker-compose.yaml index 094f20a08..446508e25 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -15,6 +15,7 @@ services: environment: - REDIS_URL=redis://redis:6379 - POSTGRES_HOST=postgres + - RAILS_ENV=development command: ["foreman", "start", "-f", "./docker/Procfile.docker.dev"] postgres: diff --git a/docker/Dockerfile b/docker/Dockerfile index 69da9c48d..b99daf952 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -20,9 +20,11 @@ RUN mkdir -p /app WORKDIR /app COPY . /app +ENV RAILS_SERVE_STATIC_FILES true +ENV RAILS_ENV=production + RUN bundle -RUN yarn -RUN bundle exec rake assets:precompile +RUN SECRET_KEY_BASE=precompile_placeholder bundle exec rake assets:precompile # Add a script to be executed every time the container starts. COPY ./docker/entrypoint.sh /usr/bin/