Skip to content

Commit 3cbe509

Browse files
raylimCopilot
andcommitted
fix: remove deleted azure_batch scripts from Dockerfile
- Remove COPY scripts/azure_batch which no longer exists in the repo - Remove chmod +x on azure_batch scripts - Add entrypoint.sh (user/group permission management via gosu) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1fd5189 commit 3cbe509

2 files changed

Lines changed: 52 additions & 4 deletions

File tree

Dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ WORKDIR /app
104104
# Copy only the installed package from site-packages, not all source files
105105
RUN mkdir -p /app
106106

107-
# Copy scripts directory for Azure Batch
108-
COPY scripts /app/scripts
109-
RUN chmod +x /app/scripts/azure_batch/*.sh
110-
111107
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
112108
RUN chmod +x /usr/local/bin/entrypoint.sh
113109

entrypoint.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Entrypoint script for Mussel container
5+
# Manages user permissions and runs commands with proper UID/GID
6+
7+
# Get the user ID and group ID from environment or use defaults
8+
USER_ID="${MUSSEL_UID:-1000}"
9+
GROUP_ID="${MUSSEL_GID:-1000}"
10+
11+
# Create a user with the specified UID/GID if running as root and custom UID is requested
12+
if [ "$(id -u)" = "0" ] && [ "$USER_ID" != "0" ]; then
13+
# Create group if it doesn't exist
14+
if ! getent group mussel >/dev/null 2>&1; then
15+
groupadd -g "$GROUP_ID" mussel
16+
fi
17+
18+
# Create user if it doesn't exist
19+
if ! id -u mussel >/dev/null 2>&1; then
20+
useradd -u "$USER_ID" -g "$GROUP_ID" -m -s /bin/bash mussel
21+
fi
22+
23+
# Ensure writable cache directories
24+
mkdir -p /.cache /tmp
25+
chown -R mussel:mussel /.cache /tmp || true
26+
chmod -R 777 /.cache /tmp
27+
28+
# Ensure output directory exists and is writable (Azure Batch expects this)
29+
if [ -n "$AZ_BATCH_TASK_WORKING_DIR" ]; then
30+
mkdir -p "$AZ_BATCH_TASK_WORKING_DIR/output"
31+
chmod -R 777 "$AZ_BATCH_TASK_WORKING_DIR/output" || true
32+
fi
33+
mkdir -p /tmp/output
34+
chmod 777 /tmp/output || true
35+
36+
# Ensure cache directories are writable by mussel user if they're set
37+
if [ -n "$TMPDIR" ] && [ -d "$TMPDIR" ]; then
38+
chown -R mussel:mussel "$TMPDIR" 2>/dev/null || chmod -R 777 "$TMPDIR" 2>/dev/null || true
39+
fi
40+
if [ -n "$TORCH_HOME" ] && [ -d "$TORCH_HOME" ]; then
41+
chown -R mussel:mussel "$TORCH_HOME" 2>/dev/null || chmod -R 777 "$TORCH_HOME" 2>/dev/null || true
42+
fi
43+
if [ -n "$HF_HOME" ] && [ -d "$HF_HOME" ]; then
44+
chown -R mussel:mussel "$HF_HOME" 2>/dev/null || chmod -R 777 "$HF_HOME" 2>/dev/null || true
45+
fi
46+
47+
# Switch to the created user and execute the command
48+
exec gosu mussel "$@"
49+
else
50+
# Not root or no custom UID requested - run directly
51+
exec "$@"
52+
fi

0 commit comments

Comments
 (0)