Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions backend.ai-manager.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ARG PYTHON_VERSION
FROM python:${PYTHON_VERSION} AS builder
ARG PKGVER
COPY dist /dist
RUN pip wheel --wheel-dir=/wheels --no-cache-dir backend.ai-manager==${PKGVER} --find-links=/dist
Comment on lines +1 to +5
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like we need to do the wheel build inside the dockerfile.


FROM python:${PYTHON_VERSION}
COPY --from=builder /wheels /wheels
RUN mkdir -p /root/.ssh
RUN apt-get update && apt-get install -y vim && rm -rf /var/lib/apt/lists/*
Copy link

Copilot AI Sep 17, 2025

Choose a reason for hiding this comment

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

Installing vim in a production container image adds unnecessary bloat. Consider removing this package unless it's specifically required for debugging purposes in production environments.

Suggested change
RUN apt-get update && apt-get install -y vim && rm -rf /var/lib/apt/lists/*
# Removed vim installation to reduce image bloat

Copilot uses AI. Check for mistakes.
RUN pip install --no-cache-dir /wheels/*.whl

# Create necessary directories
RUN mkdir -p /tmp/backend.ai/ipc /var/log/backend.ai /etc/backend.ai /app/fixtures

# Set working directory
WORKDIR /app

# Copy entrypoint script
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh

# Expose the manager service port
EXPOSE 8091

# Set the default command to run the entrypoint script
CMD ["/app/entrypoint.sh"]
27 changes: 27 additions & 0 deletions entrypoint.sh
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the purpose of this script?

Copy link
Member Author

Choose a reason for hiding this comment

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

If the RPC key doesn't exist, you'll need to create it. The execution part has become complicated, so I separated it into an sh file.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -e

echo "=== Backend.AI Manager Container starting ==="

# fixtures directory creation (default path structure)
mkdir -p /app/fixtures/manager

# RPC keypair not found. Generating...
Copy link

Copilot AI Sep 17, 2025

Choose a reason for hiding this comment

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

The comment on line 9 is misleading as it states 'RPC keypair not found' before the actual check. This comment should either be removed or moved inside the if block where the keypair is actually determined to be missing.

Suggested change
# RPC keypair not found. Generating...

Copilot uses AI. Check for mistakes.
if [ ! -f "/app/fixtures/manager/manager.key" ] || [ ! -f "/app/fixtures/manager/manager.key_secret" ]; then
echo "RPC keypair not found. Generating..."
python -m ai.backend.manager.cli generate-rpc-keypair /app/fixtures/manager 'manager'
echo "RPC keypair generated successfully."
echo " - Public Key: /app/fixtures/manager/manager.key"
echo " - Secret Key: /app/fixtures/manager/manager.key_secret"
else
echo "RPC keypair already exists."
fi

# Log directory creation
mkdir -p /var/log/backend.ai

# IPC directory creation
mkdir -p /tmp/backend.ai/ipc

echo "=== Manager server starting ==="
exec python -m ai.backend.manager.server --config /etc/backend.ai/manager.toml
Loading