From 30dd48defaf2703ba57018317c9120c31c128c24 Mon Sep 17 00:00:00 2001 From: Adam Cooke Date: Thu, 29 Jul 2021 16:47:23 +0000 Subject: [PATCH] build: add postal ./bin to path and set config root in container --- .dockerignore | 25 +++++++++++-------------- Dockerfile | 12 ++++++++---- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.dockerignore b/.dockerignore index 2f3a0c4..f57924d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,22 +1,19 @@ -/.bundle .byebug_history -config/postal.yml -config/smtp.cert -config/smtp.key -config/signing.key -public/assets -vendor/bundle -Procfile.local -log/* -storage/* -tmp/* +.cache .git/* .github/* .vscode/* .yardoc/* +/.bundle +config/postal/* doc/* -Procfile* -node_modules Dockerfile +log/* +node_modules +Procfile.local +Procfile* +public/assets +storage/* +tmp/* +vendor/bundle vendor/bundle -.cache diff --git a/Dockerfile b/Dockerfile index efaf07e..dd0f61a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,10 @@ RUN apt-get update && \ RUN setcap 'cap_net_bind_service=+ep' /usr/local/bin/ruby +# Configure 'postal' to work everywhere (when the binary exists +# later in this process) +ENV PATH="/opt/postal/app/bin:${PATH}" + # Setup an application RUN useradd -r -d /opt/postal -m -s /bin/bash -u 999 postal USER postal @@ -45,18 +49,18 @@ COPY --chown=postal . . ARG VERSION=unspecified RUN echo $VERSION > VERSION +# Set the path to the config +ENV POSTAL_CONFIG_ROOT=/config + # Set the CMD ENTRYPOINT [ "/docker-entrypoint.sh" ] -CMD ["bundle", "exec"] +CMD ["postal"] # ci target - use --target=ci to skip asset compilation FROM base AS ci # prod target - default if no --target option is given FROM base AS prod -# Copy temporary configuration file which can be used for -# running the asset precompilation. -COPY --chown=postal config/postal.defaults.yml /opt/postal/config/postal.yml RUN POSTAL_SKIP_CONFIG_CHECK=1 RAILS_GROUPS=assets bundle exec rake assets:precompile RUN touch /opt/postal/app/public/assets/.prebuilt