add homebrew in docker

This commit is contained in:
fuleinist 2026-01-28 11:07:04 +11:00
parent 0b1c8db0ca
commit 7d09105001

View File

@ -8,7 +8,7 @@ RUN corepack enable
WORKDIR /app WORKDIR /app
ARG CLAWDBOT_DOCKER_APT_PACKAGES="" ARG CLAWDBOT_DOCKER_APT_PACKAGES="build-essential procps curl file git"
RUN if [ -n "$CLAWDBOT_DOCKER_APT_PACKAGES" ]; then \ RUN if [ -n "$CLAWDBOT_DOCKER_APT_PACKAGES" ]; then \
apt-get update && \ apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $CLAWDBOT_DOCKER_APT_PACKAGES && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $CLAWDBOT_DOCKER_APT_PACKAGES && \
@ -32,9 +32,18 @@ RUN pnpm ui:build
ENV NODE_ENV=production ENV NODE_ENV=production
# Setup Homebrew directory permissions
RUN mkdir -p /home/linuxbrew/.linuxbrew && \
chown -R node:node /home/linuxbrew
# Security hardening: Run as non-root user # Security hardening: Run as non-root user
# The node:22-bookworm image includes a 'node' user (uid 1000) # The node:22-bookworm image includes a 'node' user (uid 1000)
# This reduces the attack surface by preventing container escape via root privileges # This reduces the attack surface by preventing container escape via root privileges
USER node USER node
# Install Homebrew
ENV NONINTERACTIVE=1
RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
ENV PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${PATH}"
CMD ["node", "dist/index.js"] CMD ["node", "dist/index.js"]