Skip to content

Update Dockerfile for more efficiency #588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .controlplane/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,18 @@ ENV RAILS_ENV=production \
SECRET_KEY_BASE=NOT_USED_NON_BLANK
# compiling assets requires any value for ENV of SECRET_KEY_BASE

RUN yarn res:build
# These files hardly ever change
RUN bin/rails react_on_rails:locale
RUN bin/rails assets:precompile

# These files change together, /app/lib/bs are temp build files for rescript,
# and /app/client/app are the client assets that are bundled, so not needed once built
# Helps to have smaller images b/c of smaller Docker Layer Caches and smaller final images
RUN yarn res:build && bin/rails assets:precompile && rm -rf /app/lib/bs /app/client/app

# This is like the shell initialization that will take the CMD as args
# For Kubernetes and ControlPlane, this is the command on the workload.
ENTRYPOINT ["./.controlplane/entrypoint.sh"]

# Default args to pass to the entry point that can be overridden
# For Kubernetes and ControlPlane, these are the "workload args"
CMD ["./bin/rails", "server"]