Fix permissions for real this time

This commit is contained in:
Ryan Hughes
2025-10-23 00:16:11 -04:00
parent 26ac717c3a
commit db283dd98a
2 changed files with 16 additions and 22 deletions
+11 -8
View File
@@ -123,17 +123,20 @@ else
print_success "GPG signing key and passphrase loaded"
fi
# Build/update the Docker image with host user's UID/GID for proper permissions
# Build/update the Docker image
print_info "Building Docker image..."
HOST_UID=$(id -u)
HOST_GID=$(id -g)
docker build \
--build-arg BUILD_UID="$HOST_UID" \
--build-arg BUILD_GID="$HOST_GID" \
-t omarchy-aur-builder:latest \
-f "$BUILD_DIR/Dockerfile" "$BUILD_DIR"
docker build -t omarchy-aur-builder:latest -f "$BUILD_DIR/Dockerfile" "$BUILD_DIR"
print_info "Running AUR package build..."
# Ensure output directory is writable by container user
# The container runs as 'builder' user, so we need to make output writable
if [ "$(id -u)" -eq 0 ]; then
chmod -R 777 "$ARCH_DIR"
else
sudo chown -R $(id -u):$(id -g) "$ARCH_DIR" 2>/dev/null || chmod -R 777 "$ARCH_DIR"
fi
# Build Docker arguments
DOCKER_ARGS=(
--rm
+5 -14
View File
@@ -4,23 +4,14 @@ FROM archlinux:latest
RUN pacman -Syu --noconfirm && \
pacman -S --noconfirm base-devel git sudo wget jq gnupg
# Create build user (required for makepkg)
# Note: UID/GID can be overridden at runtime via --build-arg
ARG BUILD_UID=1000
ARG BUILD_GID=1000
# Create build user (required for makepkg - cannot run as root)
RUN useradd -m -G wheel builder && \
echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Only create builder user if not using root (UID 0)
RUN if [ ${BUILD_UID} -ne 0 ]; then \
groupadd -g ${BUILD_GID} builder && \
useradd -m -u ${BUILD_UID} -g ${BUILD_GID} -G wheel builder && \
echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers; \
fi
# Switch to builder user if not root, otherwise stay as root
USER ${BUILD_UID}
USER builder
WORKDIR /src
# Setup GPG directory for whichever user we're using
# Setup GPG directory
RUN mkdir -p ~/.gnupg && chmod 700 ~/.gnupg
# Default command