Skip to content

feat: enhance entrypoint and Dockerfiles for flexible volume and permission management #260

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 6 commits into from
Jul 19, 2025

Conversation

overtrue
Copy link
Collaborator

Summary

  • entrypoint.sh now supports batch volume mount (RUSTFS_VOLUMES) and flexible UID/GID/ownership fix for all mount points.
  • Dockerfile/Dockerfile.source install required tools (coreutils, shadow/passwd) for permission management.
  • Both production and local dev images now use unified ENTRYPOINT and permission logic.
  • Security improved: default credentials warning, directory chmod 700, non-root startup.
  • User experience improved: batch mount, SKIP_CHOWN, clear logs.

BREAKING CHANGE:

  • entrypoint.sh and Dockerfile now require additional packages for permission management.
  • Batch volume mount via RUSTFS_VOLUMES is now supported.

Testing

  • Build and run image with default and custom volumes
  • Verified UID/GID/ownership logic
  • Confirmed backward compatibility for /data, /logs

Closes # (please fill if related)

…ission management\n\n- Support batch mount and permission fix in entrypoint.sh\n- Add coreutils/shadow (alpine) and coreutils/passwd (ubuntu) for UID/GID/ownership\n- Use ENTRYPOINT for unified startup\n- Make local dev and prod Dockerfile behavior consistent\n- Improve security and user experience\n\nBREAKING CHANGE: entrypoint.sh and Dockerfile now require additional packages for permission management, and support batch volume mount via RUSTFS_VOLUMES.
@overtrue overtrue marked this pull request as draft July 19, 2025 03:12
@overtrue overtrue requested a review from Copilot July 19, 2025 03:44
@overtrue overtrue marked this pull request as ready for review July 19, 2025 03:44
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the Docker setup with flexible volume and permission management capabilities. The changes introduce batch volume mounting support via RUSTFS_VOLUMES environment variable, unified permission handling across different mount points, and improved security defaults.

  • Refactored entrypoint script to support multiple volumes and flexible UID/GID management
  • Updated both Dockerfiles to include required system tools (coreutils, shadow/passwd) for permission operations
  • Added security improvements including default credential warnings and proper non-root user configuration

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
entrypoint.sh Complete rewrite to support batch volume processing, flexible UID/GID handling, and improved permission management
Dockerfile.source Added required system packages and entrypoint integration for Debian-based builds
Dockerfile Updated Alpine-based build with architecture handling improvements and required packages

if [ "$dir_uid" != "$APP_UID" ] || [ "$dir_gid" != "$APP_GID" ]; then
if [[ "$SKIP_CHOWN" != "true" ]]; then
# Prefer to update rustfs user/group UID/GID
update_user_group_ids "$dir_uid" "$dir_gid" "$APP_USER" "$APP_GROUP" || \
Copy link
Preview

Copilot AI Jul 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function update_user_group_ids uses return $updated where updated is 0 or 1, but the logic expects failure when user/group modification isn't possible. This creates incorrect fallback behavior since return 0 indicates success in bash. Consider returning 1 when modifications fail or restructure the logic.

Copilot uses AI. Check for mistakes.

echo "ARCH=${ARCH}" > /build/arch.env

# Download and extract RustFS binary
RUN . /build/arch.env && \
BASE_URL="https://dl.rustfs.com/artifacts/rustfs/release" && \
Copy link
Preview

Copilot AI Jul 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter expansion ${RELEASE#v} will remove a leading 'v' from RELEASE, but if RELEASE doesn't start with 'v', it remains unchanged. This could cause download failures if the naming convention isn't consistent. Consider validating the RELEASE format or using a more robust parsing approach.

Suggested change
BASE_URL="https://dl.rustfs.com/artifacts/rustfs/release" && \
BASE_URL="https://dl.rustfs.com/artifacts/rustfs/release" && \
if [[ "${RELEASE}" != v* ]]; then \
echo "Invalid RELEASE format: ${RELEASE}. Expected format: 'v<version>'." >&2 && exit 1; \
fi && \

Copilot uses AI. Check for mistakes.

overtrue and others added 3 commits July 19, 2025 11:46
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@overtrue overtrue merged commit f27ee96 into main Jul 19, 2025
3 checks passed
@overtrue overtrue deleted the feat/entrypoint-docker-enhance branch July 19, 2025 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant