-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofiles.go
More file actions
181 lines (166 loc) · 6.74 KB
/
profiles.go
File metadata and controls
181 lines (166 loc) · 6.74 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
package sbox
// Profile represents a development profile that can be installed in the sandbox
type Profile struct {
// Name is the unique identifier for this profile
Name string
// Description provides a human-readable explanation of what this profile provides
Description string
// Dependencies lists other profiles that must be installed before this one
Dependencies []string
// DockerfileSnippet contains the Dockerfile commands to install this profile's tools
DockerfileSnippet string
}
// BuiltinProfiles contains all available built-in profiles
var BuiltinProfiles = map[string]Profile{
"go": {
Name: "go",
Description: "Go programming language toolchain (latest stable version)",
DockerfileSnippet: `# Go toolchain
RUN apt-get update && apt-get install -y wget && \
wget -q https://go.dev/dl/go1.24.4.linux-${GO_ARCH}.tar.gz && \
tar -C /usr/local -xzf go1.24.4.linux-${GO_ARCH}.tar.gz && \
rm go1.24.4.linux-${GO_ARCH}.tar.gz && \
apt-get clean && rm -rf /var/lib/apt/lists/*
ENV PATH="/usr/local/go/bin:${PATH}"
ENV GOPATH="/workspace/.go"
ENV PATH="${GOPATH}/bin:${PATH}"
`,
},
"rust": {
Name: "rust",
Description: "Rust programming language toolchain (stable)",
DockerfileSnippet: `# Rust toolchain (installed system-wide for all users)
ENV RUSTUP_HOME="/usr/local/rustup"
ENV CARGO_HOME="/usr/local/cargo"
ENV PATH="/usr/local/cargo/bin:${PATH}"
RUN apt-get update && apt-get install -y curl build-essential && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path && \
chmod -R a+rwx /usr/local/rustup /usr/local/cargo && \
apt-get clean && rm -rf /var/lib/apt/lists/*
`,
},
"docker": {
Name: "docker",
Description: "Docker CLI tools for container management",
DockerfileSnippet: `# Docker CLI
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get update && apt-get install -y docker-ce-cli docker-compose-plugin && \
apt-get clean && rm -rf /var/lib/apt/lists/*
`,
},
"bash-utils": {
Name: "bash-utils",
Description: "Common shell utilities (jq, yq, curl, wget, git)",
DockerfileSnippet: `# Bash utilities
RUN apt-get update && apt-get install -y \
jq \
curl \
wget \
git \
vim \
nano \
htop \
tree \
zip \
unzip && \
wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_${YQ_ARCH} && \
chmod +x /usr/local/bin/yq && \
apt-get clean && rm -rf /var/lib/apt/lists/*
`,
},
"substreams": {
Name: "substreams",
Description: "Substreams and Firehose Core CLI tools for blockchain data",
Dependencies: []string{"rust"},
DockerfileSnippet: `# Substreams CLI (from official Docker image)
COPY --from=ghcr.io/streamingfast/substreams:latest /app/substreams /usr/local/bin/substreams
# Firehose Core CLI (from official Docker image)
COPY --from=ghcr.io/streamingfast/firehose-core:latest /app/firecore /usr/local/bin/firecore
# buf CLI and protoc (protobuf compiler)
RUN apt-get update && apt-get install -y curl unzip && \
curl -sSL "https://github.com/bufbuild/buf/releases/latest/download/buf-$(uname -s)-$(uname -m)" -o /usr/local/bin/buf && \
chmod +x /usr/local/bin/buf && \
PROTOC_VERSION=$(curl -sSL https://api.github.com/repos/protocolbuffers/protobuf/releases/latest | grep '"tag_name"' | sed 's/.*"v\(.*\)".*/\1/') && \
curl -sSL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip" -o /tmp/protoc.zip && \
unzip -o /tmp/protoc.zip -d /usr/local bin/protoc 'include/*' && \
rm /tmp/protoc.zip && \
apt-get clean && rm -rf /var/lib/apt/lists/*
`,
},
"javascript": {
Name: "javascript",
Description: "JavaScript/TypeScript development tools (pnpm, yarn)",
DockerfileSnippet: `# JavaScript package managers (pnpm, yarn)
# Note: Node.js and npm are already installed in the base image
RUN npm install -g pnpm yarn
`,
},
"firehose": {
Name: "firehose",
Description: "Firehose CLI tools (substreams, firecore, fireeth, dummy-blockchain) and grpcurl for blockchain data streaming",
DockerfileSnippet: `# Substreams CLI (from official Docker image)
COPY --from=ghcr.io/streamingfast/substreams:latest /app/substreams /usr/local/bin/substreams
# Firehose Core CLI (from official Docker image)
COPY --from=ghcr.io/streamingfast/firehose-core:latest /app/firecore /usr/local/bin/firecore
# Firehose Ethereum CLI (from official Docker image)
COPY --from=ghcr.io/streamingfast/firehose-ethereum:latest /app/fireeth /usr/local/bin/fireeth
# Dummy Blockchain (from official Docker image)
COPY --from=ghcr.io/streamingfast/dummy-blockchain:latest /app/dummy-blockchain /usr/local/bin/dummy-blockchain
# grpcurl CLI
RUN apt-get update && apt-get install -y curl && \
GRPCURL_VERSION=$(curl -sSL https://api.github.com/repos/fullstorydev/grpcurl/releases/latest | grep '"tag_name"' | sed 's/.*"v\(.*\)".*/\1/') && \
curl -sSL "https://github.com/fullstorydev/grpcurl/releases/download/v${GRPCURL_VERSION}/grpcurl_${GRPCURL_VERSION}_linux_${GRPCURL_ARCH}.tar.gz" -o /tmp/grpcurl.tar.gz && \
tar -xzf /tmp/grpcurl.tar.gz -C /usr/local/bin grpcurl && \
rm /tmp/grpcurl.tar.gz && \
apt-get clean && rm -rf /var/lib/apt/lists/*
`,
},
"sql": {
Name: "sql",
Description: "SQL development tools (PostgreSQL client)",
DockerfileSnippet: `# PostgreSQL client for SQL development
RUN apt-get update && apt-get install -y \
postgresql-client && \
apt-get clean && rm -rf /var/lib/apt/lists/*
`,
},
"cpp": {
Name: "cpp",
Description: "C/C++ development tools (Boost, libc++, build tools, compression libs)",
DockerfileSnippet: `# C/C++ development tools
RUN apt-get update && apt-get install -y \
build-essential \
libboost-all-dev \
libc++-dev \
libstdc++-14-dev \
autoconf \
automake \
libtool \
ninja-build \
libzstd-dev \
zlib1g-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*
`,
},
}
// GetProfile retrieves a profile by name
func GetProfile(name string) (Profile, bool) {
profile, ok := BuiltinProfiles[name]
return profile, ok
}
// ListProfiles returns a sorted list of all available profile names
func ListProfiles() []string {
names := make([]string, 0, len(BuiltinProfiles))
for name := range BuiltinProfiles {
names = append(names, name)
}
return names
}