@alchemy.run/docker 2.0.0-beta.84 → 2.0.0-beta.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/lib/Bootstrap.d.ts.map +1 -1
- package/lib/Bootstrap.js +2 -1
- package/lib/Bootstrap.js.map +1 -1
- package/lib/BuildCache.d.ts +87 -0
- package/lib/BuildCache.d.ts.map +1 -0
- package/lib/BuildCache.js +39 -0
- package/lib/BuildCache.js.map +1 -0
- package/lib/BuildHash.d.ts +20 -3
- package/lib/BuildHash.d.ts.map +1 -1
- package/lib/BuildHash.js +60 -21
- package/lib/BuildHash.js.map +1 -1
- package/lib/BuildPlan.d.ts +202 -0
- package/lib/BuildPlan.d.ts.map +1 -0
- package/lib/BuildPlan.js +514 -0
- package/lib/BuildPlan.js.map +1 -0
- package/lib/Container.d.ts +122 -1
- package/lib/Container.d.ts.map +1 -1
- package/lib/Container.js +232 -4
- package/lib/Container.js.map +1 -1
- package/lib/Context.d.ts +20 -1
- package/lib/Context.d.ts.map +1 -1
- package/lib/Context.js +15 -0
- package/lib/Context.js.map +1 -1
- package/lib/Docker.d.ts +113 -1
- package/lib/Docker.d.ts.map +1 -1
- package/lib/Docker.js +50 -8
- package/lib/Docker.js.map +1 -1
- package/lib/Dockerfile.d.ts +0 -2
- package/lib/Dockerfile.d.ts.map +1 -1
- package/lib/Dockerfile.js.map +1 -1
- package/lib/DockerfileParser.d.ts +125 -0
- package/lib/DockerfileParser.d.ts.map +1 -0
- package/lib/DockerfileParser.js +1040 -0
- package/lib/DockerfileParser.js.map +1 -0
- package/lib/HealthcheckCommand.d.ts.map +1 -1
- package/lib/HealthcheckCommand.js.map +1 -1
- package/lib/Image.d.ts +69 -13
- package/lib/Image.d.ts.map +1 -1
- package/lib/Image.js +59 -9
- package/lib/Image.js.map +1 -1
- package/lib/ImageArchive.d.ts +41 -0
- package/lib/ImageArchive.d.ts.map +1 -0
- package/lib/ImageArchive.js +54 -0
- package/lib/ImageArchive.js.map +1 -0
- package/lib/ImageSource.d.ts +151 -8
- package/lib/ImageSource.d.ts.map +1 -1
- package/lib/ImageSource.js +247 -72
- package/lib/ImageSource.js.map +1 -1
- package/lib/Network.d.ts +175 -3
- package/lib/Network.d.ts.map +1 -1
- package/lib/Network.js +296 -8
- package/lib/Network.js.map +1 -1
- package/lib/Providers.d.ts.map +1 -1
- package/lib/Providers.js.map +1 -1
- package/lib/Registry.d.ts.map +1 -1
- package/lib/Registry.js.map +1 -1
- package/lib/RegistryError.d.ts.map +1 -1
- package/lib/RegistryError.js.map +1 -1
- package/lib/RemoteImage.d.ts.map +1 -1
- package/lib/RemoteImage.js +1 -1
- package/lib/RemoteImage.js.map +1 -1
- package/lib/Service.d.ts +24 -3
- package/lib/Service.d.ts.map +1 -1
- package/lib/Service.js +154 -12
- package/lib/Service.js.map +1 -1
- package/lib/ServiceImage.d.ts.map +1 -1
- package/lib/ServiceImage.js.map +1 -1
- package/lib/ShellWord.d.ts +28 -0
- package/lib/ShellWord.d.ts.map +1 -0
- package/lib/ShellWord.js +301 -0
- package/lib/ShellWord.js.map +1 -0
- package/lib/Swarm.d.ts.map +1 -1
- package/lib/Swarm.js.map +1 -1
- package/lib/Volume.d.ts +24 -1
- package/lib/Volume.d.ts.map +1 -1
- package/lib/Volume.js +16 -0
- package/lib/Volume.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +9 -9
- package/src/Bootstrap.ts +2 -0
- package/src/BuildCache.ts +111 -0
- package/src/BuildHash.ts +85 -26
- package/src/BuildPlan.ts +758 -0
- package/src/Container.ts +361 -5
- package/src/Context.ts +27 -1
- package/src/Docker.ts +157 -9
- package/src/Dockerfile.ts +0 -2
- package/src/DockerfileParser.ts +1152 -0
- package/src/Image.ts +75 -15
- package/src/ImageArchive.ts +77 -0
- package/src/ImageSource.ts +391 -99
- package/src/Network.ts +432 -10
- package/src/RemoteImage.ts +1 -1
- package/src/Service.ts +246 -62
- package/src/ShellWord.ts +326 -0
- package/src/Volume.ts +33 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
declare const DockerfileSyntaxError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
3
|
+
readonly _tag: "DockerfileSyntaxError";
|
|
4
|
+
} & Readonly<A>;
|
|
5
|
+
/**
|
|
6
|
+
* A Dockerfile parsed into stages and instructions, with the line each one
|
|
7
|
+
* starts on. Builders that are not Docker (E2B, Modal, Daytona) lower this
|
|
8
|
+
* structure into their own build steps instead of running `docker build`.
|
|
9
|
+
*
|
|
10
|
+
* The parser is a port of BuildKit's (`frontend/dockerfile/parser` and the
|
|
11
|
+
* checks in `instructions`), and is tested against it: parser directives,
|
|
12
|
+
* line continuations, heredocs, exec and shell forms, `--flag[=value]`
|
|
13
|
+
* options, Docker's quoting, and the files BuildKit rejects. It does not
|
|
14
|
+
* expand variables: lowering decides whether a builder expands them or
|
|
15
|
+
* Alchemy does.
|
|
16
|
+
*/
|
|
17
|
+
/** The Dockerfile could not be parsed. */
|
|
18
|
+
export declare class DockerfileSyntaxError extends DockerfileSyntaxError_base<{
|
|
19
|
+
readonly message: string;
|
|
20
|
+
/** 1-based line the error was found on. */
|
|
21
|
+
readonly line: number;
|
|
22
|
+
}> {
|
|
23
|
+
}
|
|
24
|
+
/** A `--name` or `--name=value` option on an instruction. */
|
|
25
|
+
export interface Flag {
|
|
26
|
+
readonly name: string;
|
|
27
|
+
readonly value: string | undefined;
|
|
28
|
+
}
|
|
29
|
+
/** A heredoc attached to an instruction (`RUN <<EOF … EOF`). */
|
|
30
|
+
export interface Heredoc {
|
|
31
|
+
/** The delimiter word, e.g. `EOF`. */
|
|
32
|
+
readonly name: string;
|
|
33
|
+
/** The body, without the closing delimiter line. */
|
|
34
|
+
readonly content: string;
|
|
35
|
+
/** `<<-`: leading tabs were stripped from the body. */
|
|
36
|
+
readonly stripTabs: boolean;
|
|
37
|
+
/** A quoted delimiter (`<<"EOF"`): the body is not expanded. */
|
|
38
|
+
readonly quoted: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** The exec form (`["bun", "index.mjs"]`) or the shell form (`bun index.mjs`). */
|
|
41
|
+
export type Command = {
|
|
42
|
+
readonly form: "exec";
|
|
43
|
+
readonly argv: ReadonlyArray<string>;
|
|
44
|
+
} | {
|
|
45
|
+
readonly form: "shell";
|
|
46
|
+
readonly script: string;
|
|
47
|
+
};
|
|
48
|
+
interface InstructionBase {
|
|
49
|
+
/** 1-based line the instruction starts on. */
|
|
50
|
+
readonly line: number;
|
|
51
|
+
/** The instruction as written: the joined logical line, plus heredoc bodies. */
|
|
52
|
+
readonly raw: string;
|
|
53
|
+
readonly flags: ReadonlyArray<Flag>;
|
|
54
|
+
}
|
|
55
|
+
export interface RunInstruction extends InstructionBase {
|
|
56
|
+
readonly _tag: "RUN";
|
|
57
|
+
readonly command: Command;
|
|
58
|
+
readonly heredocs: ReadonlyArray<Heredoc>;
|
|
59
|
+
}
|
|
60
|
+
export interface CopyInstruction extends InstructionBase {
|
|
61
|
+
readonly _tag: "COPY" | "ADD";
|
|
62
|
+
/** Context-relative sources, URLs (ADD), or `<<NAME` heredoc references. */
|
|
63
|
+
readonly sources: ReadonlyArray<string>;
|
|
64
|
+
readonly destination: string;
|
|
65
|
+
readonly heredocs: ReadonlyArray<Heredoc>;
|
|
66
|
+
}
|
|
67
|
+
export interface EnvInstruction extends InstructionBase {
|
|
68
|
+
readonly _tag: "ENV";
|
|
69
|
+
readonly vars: ReadonlyArray<readonly [name: string, value: string]>;
|
|
70
|
+
}
|
|
71
|
+
export interface ArgInstruction extends InstructionBase {
|
|
72
|
+
readonly _tag: "ARG";
|
|
73
|
+
readonly vars: ReadonlyArray<readonly [name: string, defaultValue: string | undefined]>;
|
|
74
|
+
}
|
|
75
|
+
export interface ValueInstruction extends InstructionBase {
|
|
76
|
+
readonly _tag: "WORKDIR" | "USER" | "STOPSIGNAL";
|
|
77
|
+
readonly value: string;
|
|
78
|
+
}
|
|
79
|
+
export interface CommandInstruction extends InstructionBase {
|
|
80
|
+
readonly _tag: "CMD" | "ENTRYPOINT" | "SHELL";
|
|
81
|
+
readonly command: Command;
|
|
82
|
+
}
|
|
83
|
+
export interface OtherInstruction extends InstructionBase {
|
|
84
|
+
readonly _tag: "EXPOSE" | "LABEL" | "HEALTHCHECK" | "VOLUME" | "ONBUILD" | "MAINTAINER";
|
|
85
|
+
/** Everything after the instruction name and its flags. */
|
|
86
|
+
readonly args: string;
|
|
87
|
+
}
|
|
88
|
+
export type Instruction = RunInstruction | CopyInstruction | EnvInstruction | ArgInstruction | ValueInstruction | CommandInstruction | OtherInstruction;
|
|
89
|
+
export type InstructionName = Instruction["_tag"] | "FROM";
|
|
90
|
+
/** One `FROM` and the instructions after it. */
|
|
91
|
+
export interface Stage {
|
|
92
|
+
/** 1-based line of the `FROM`. */
|
|
93
|
+
readonly line: number;
|
|
94
|
+
/** The `FROM` line as written. */
|
|
95
|
+
readonly raw: string;
|
|
96
|
+
/** The base: an image reference, an earlier stage's name, or `scratch`. */
|
|
97
|
+
readonly image: string;
|
|
98
|
+
/** `FROM … AS name`. */
|
|
99
|
+
readonly name: string | undefined;
|
|
100
|
+
readonly flags: ReadonlyArray<Flag>;
|
|
101
|
+
readonly instructions: ReadonlyArray<Instruction>;
|
|
102
|
+
}
|
|
103
|
+
export interface ParsedDockerfile {
|
|
104
|
+
/** Parser directives, e.g. `{ syntax: "docker/dockerfile:1", escape: "\\" }`. */
|
|
105
|
+
readonly directives: Readonly<Record<string, string>>;
|
|
106
|
+
/** `ARG`s declared before the first `FROM`. */
|
|
107
|
+
readonly globalArgs: ReadonlyArray<ArgInstruction>;
|
|
108
|
+
readonly stages: ReadonlyArray<Stage>;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Parse Dockerfile text into stages and instructions, as BuildKit reads it:
|
|
112
|
+
* the same directives, continuations, heredocs, word splitting and quoting,
|
|
113
|
+
* and the same files rejected. Values have their quotes and escapes
|
|
114
|
+
* resolved; variables are left as written for the builder to expand.
|
|
115
|
+
*/
|
|
116
|
+
export declare const parse: (text: string) => Effect.Effect<ParsedDockerfile, DockerfileSyntaxError>;
|
|
117
|
+
/**
|
|
118
|
+
* Render a parsed Dockerfile back to text, one instruction per entry, each
|
|
119
|
+
* exactly as written (continuations and heredoc bodies included).
|
|
120
|
+
*/
|
|
121
|
+
export declare const renderLines: (dockerfile: ParsedDockerfile) => string[];
|
|
122
|
+
/** Render a parsed Dockerfile back to text. */
|
|
123
|
+
export declare const render: (dockerfile: ParsedDockerfile) => string;
|
|
124
|
+
export {};
|
|
125
|
+
//# sourceMappingURL=DockerfileParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DockerfileParser.d.ts","sources":["../src/DockerfileParser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;;;;AAIxC;;;;;;;;;;;GAWG;AAEH,0CAA0C;AAC1C,qBAAa,qBAAsB,SAAQ,2BAA0C;IACnF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;CAAG;AAEL,6DAA6D;AAC7D,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED,gEAAgE;AAChE,MAAM,WAAW,OAAO;IACtB,sCAAsC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC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