Merge 658c989d8b
This commit is contained in:
15
Dockerfile
15
Dockerfile
@@ -51,19 +51,18 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
|
|||||||
# Final stage for app image
|
# Final stage for app image
|
||||||
FROM base
|
FROM base
|
||||||
|
|
||||||
|
# Run and own only the runtime files as a non-root user for security
|
||||||
|
RUN groupadd --system --gid 1000 rails && \
|
||||||
|
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash
|
||||||
|
USER 1000:1000
|
||||||
|
|
||||||
# Copy built artifacts: gems, application
|
# Copy built artifacts: gems, application
|
||||||
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
|
COPY --chown=rails:rails --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
|
||||||
COPY --from=build /rails /rails
|
COPY --chown=rails:rails --from=build /rails /rails
|
||||||
|
|
||||||
# TODO: find how not to depend on this hack to include the compiled SCSS.
|
# TODO: find how not to depend on this hack to include the compiled SCSS.
|
||||||
RUN cp app/assets/builds/application.css `ls public/assets/application-*.css`
|
RUN cp app/assets/builds/application.css `ls public/assets/application-*.css`
|
||||||
|
|
||||||
# Run and own only the runtime files as a non-root user for security
|
|
||||||
RUN groupadd --system --gid 1000 rails && \
|
|
||||||
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
|
|
||||||
chown -R rails:rails db log storage tmp
|
|
||||||
USER 1000:1000
|
|
||||||
|
|
||||||
# Entrypoint prepares the database.
|
# Entrypoint prepares the database.
|
||||||
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
|
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user