Documentation
¶
Overview ¶
Package vscode resolves and downloads the VS Code Server tarball that matches a given platform. The result is staged on disk so it can be COPY'd into the build context and unpacked at the canonical location VS Code expects (~/.vscode-server/bin/<commit>/).
Background: when VS Code's "Remote - Containers" extension attaches to a container, it tries to download and extract its server bin into ~/.vscode-server/bin/<commit>/. Pre-injecting that directory at build time makes the first-attach experience instant and works in offline environments.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalInstallDir ¶
CanonicalInstallDir returns the path inside a container where VS Code expects its server binary to live for a given user.
Example: CanonicalInstallDir("vscode", "abc123") =>
"/home/vscode/.vscode-server/bin/abc123"
For root, the path is /root/.vscode-server/...
func DownloadURL ¶
DownloadURL builds the official VS Code update URL for a given commit.
Pattern: https://update.code.visualstudio.com/commit:<commit>/server-linux-<arch>[-alpine]/<quality>
Types ¶
type Downloader ¶
Downloader resolves and fetches VS Code server tarballs.
func NewDownloader ¶
func NewDownloader() *Downloader
NewDownloader constructs a Downloader with sane defaults.
type Result ¶
type Result struct {
// TarballPath is the path to the downloaded tarball on disk.
TarballPath string
// Commit is the resolved commit hash used in the canonical install
// path (~/.vscode-server/bin/<Commit>/).
Commit string
// Quality is the resolved quality channel.
Quality Quality
// SHA256 is the hex digest of the tarball contents.
SHA256 string
// Bytes is the size of the tarball.
Bytes int64
// URL is the source URL that was used.
URL string
}
Result describes a staged VS Code server download.
type ServerKind ¶
type ServerKind string
ServerKind selects between vanilla VS Code Server and the open-source VSCodium-style "code-server" build. We default to VS Code Server since the devcontainer experience is most commonly used with VS Code.
const (
KindVSCodeServer ServerKind = "vscode-server"
)
type Spec ¶
type Spec struct {
Quality Quality
Kind ServerKind
Platform platform.Platform
// Commit, when non-empty, pins the download. When empty, the latest
// is queried from the update API.
Commit string
// AlpineLibc selects musl-libc-compatible binaries.
AlpineLibc bool
}
Spec describes the server variant to download.
func DefaultSpec ¶
func DefaultSpec() Spec
DefaultSpec returns a sane default spec for the current platform.