forked from skypilot-org/skypilot
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
86 lines (73 loc) · 3.17 KB
/
Dockerfile
File metadata and controls
86 lines (73 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Use the latest version with Python 3.10
FROM continuumio/miniconda3:23.3.1-0
# Detect architecture
ARG TARGETARCH
# Control Next.js basePath for staging deployments
ARG NEXT_BASE_PATH=/dashboard
# Control installation method - default to install from source
ARG INSTALL_FROM_SOURCE=true
# Install Google Cloud SDK (least likely to change)
RUN conda install -c conda-forge google-cloud-sdk
# Install GKE auth plugin
RUN gcloud components install gke-gcloud-auth-plugin --quiet && \
find /opt/conda -name 'gke-gcloud-auth-plugin' -type f -exec ln -s {} /usr/local/bin/gke-gcloud-auth-plugin \;
# Install system packages
RUN apt-get update -y && \
apt-get install --no-install-recommends -y \
git gcc rsync sudo patch openssh-server \
pciutils nano fuse socat netcat-openbsd curl rsync vim tini autossh jq && \
rm -rf /var/lib/apt/lists/*
# Install kubectl based on architecture
RUN ARCH=${TARGETARCH:-$(case "$(uname -m)" in \
"x86_64") echo "amd64" ;; \
"aarch64") echo "arm64" ;; \
*) echo "$(uname -m)" ;; \
esac)} && \
curl -LO "https://dl.k8s.io/release/v1.31.6/bin/linux/$ARCH/kubectl" && \
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \
rm kubectl
# Install Nebius CLI
RUN curl -sSL https://storage.eu-north1.nebius.cloud/cli/install.sh | NEBIUS_INSTALL_FOLDER=/usr/local/bin bash
# Install uv
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
~/.local/bin/uv pip install --prerelease allow azure-cli --system && \
if [ "$INSTALL_FROM_SOURCE" = "true" ]; then \
echo "Installing NPM and Node.js for dashboard build" && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
npm install -g npm@latest; \
fi
# Add source code
COPY . /skypilot
# Install SkyPilot and set up dashboard based on installation method
RUN cd /skypilot && \
if [ "$INSTALL_FROM_SOURCE" = "true" ]; then \
echo "Installing from source in editable mode" && \
~/.local/bin/uv pip install -e ".[all]" --system && \
echo "Building dashboard" && \
npm --prefix sky/dashboard install && \
NEXT_BASE_PATH=${NEXT_BASE_PATH} npm --prefix sky/dashboard run build; \
else \
echo "Installing from wheel file" && \
WHEEL_FILE=$(ls dist/*skypilot*.whl 2>/dev/null | head -1) && \
if [ -z "$WHEEL_FILE" ]; then \
echo "Error: No wheel file found in /skypilot/dist/" && \
ls -la /skypilot/dist/ && \
exit 1; \
fi && \
~/.local/bin/uv pip install "${WHEEL_FILE}[all]" --system && \
echo "Skipping dashboard build for wheel installation"; \
fi
# Cleanup all caches to reduce the image size
RUN conda clean -afy && \
~/.local/bin/uv cache clean && \
rm -rf ~/.cache/pip ~/.cache/uv && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
# Remove source code if installed from wheel (not needed for wheel installs)
if [ "$INSTALL_FROM_SOURCE" != "true" ]; then \
echo "Removing source code (wheel installation)" && \
rm -rf /skypilot; \
else \
echo "Keeping source code (editable installation)"; \
fi