|
|
@@ -45,18 +45,15 @@ COPY --from=builder /app/ /app/
|
|
|
COPY --from=builder /var/cache/app/ /app/
|
|
|
|
|
|
################################################################################
|
|
|
-# We want a tiny image, so don't start from base
|
|
|
-FROM ruby:2.6.3-alpine AS prod
|
|
|
+FROM base AS prod
|
|
|
|
|
|
ENV RAILS_ENV=production
|
|
|
-RUN apk add --update --no-cache $RUBY_PACKAGES
|
|
|
|
|
|
-RUN mkdir /app
|
|
|
-WORKDIR /app
|
|
|
+# Install only required gems for production, and remove any uneccesary build
|
|
|
+# packages
|
|
|
+RUN bundle install --jobs 4 --retry 5 --without development test && \
|
|
|
+ apk rm $BUILD_PACKAGES $DEV_PACKAGES
|
|
|
|
|
|
-# (Re)install only dependencies we need for prod instead of copying everything
|
|
|
-# from the builder
|
|
|
-COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
|
|
|
# Grab the app with all compiled assets and docker configuration from builder
|
|
|
COPY --from=builder /app/ /app/
|
|
|
|