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
use crate::config_struct;
use crate::shapes::{FilePath, GlobPath};
use moon_common::Id;
use schematic::Config;
config_struct!(
/// Configures `Dockerfile` generation. When configured at the workspace-level,
/// applies to all projects, but can be overridden at the project-level.
#[derive(Config)]
#[serde(default)]
pub struct DockerFileConfig {
/// A task identifier within the current project for building the project.
/// If not defined, will skip the build step.
#[serde(skip_serializing_if = "Option::is_none")]
pub build_task: Option<Id>,
/// The base Docker image to use. If not defined, will use the provided image
/// from the first matching toolchain, otherwise defaults to "scratch".
#[serde(skip_serializing_if = "Option::is_none")]
pub image: Option<String>,
/// Run the `moon docker prune` command after building the
/// project, but before starting it.
/// @since 2.0.0
#[serde(skip_serializing_if = "Option::is_none")]
pub run_prune: Option<bool>,
/// Run the `moon docker setup` command after scaffolding,
/// but before building the project.
/// @since 2.0.0
#[serde(skip_serializing_if = "Option::is_none")]
pub run_setup: Option<bool>,
/// A task identifier within the current project for starting the project
/// within the `CMD` instruction. If not defined, will skip the start step
/// and not include the `CMD` instruction.
#[serde(skip_serializing_if = "Option::is_none")]
pub start_task: Option<Id>,
/// A custom template file, relative from the workspace root, to use when
/// rendering the `Dockerfile`. Powered by Tera.
/// @since 2.0.0
#[serde(skip_serializing_if = "Option::is_none")]
pub template: Option<FilePath>,
}
);
config_struct!(
/// Configures aspects of the Docker pruning process.
#[derive(Config)]
pub struct DockerPruneConfig {
/// Automatically delete vendor directories (package manager
/// dependencies, build targets, etc) while pruning. This is
/// handled by each toolchain plugin and not moon directly.
#[setting(default = true)]
pub delete_vendor_directories: bool,
/// Automatically install production dependencies for all required
/// toolchain's of the focused projects within the Docker build.
#[setting(default = true)]
pub install_toolchain_dependencies: bool,
}
);
config_struct!(
/// Configures aspects of the Docker scaffolding process.
/// When configured at the workspace-level, applies to all projects,
/// but can be overridden at the project-level.
#[derive(Config)]
pub struct DockerScaffoldConfig {
/// List of glob patterns in which to include/exclude files in
/// the "configs" skeleton. Applies to both project and
/// workspace level scaffolding.
/// @since 2.0.0
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub configs_phase_globs: Vec<GlobPath>,
/// List of glob patterns in which to include/exclude files in
/// the "sources" skeleton. Applies to both project and
/// workspace level scaffolding.
/// @since 2.0.0
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub sources_phase_globs: Vec<GlobPath>,
}
);
config_struct!(
/// Configures our Docker integration.
#[derive(Config)]
pub struct DockerConfig {
/// Configures aspects of the `Dockerfile` generation process.
/// @since 2.0.0
#[setting(nested)]
pub file: DockerFileConfig,
/// Configures aspects of the Docker pruning process.
#[setting(nested)]
pub prune: DockerPruneConfig,
/// Configures aspects of the Docker scaffolding process.
#[setting(nested)]
pub scaffold: DockerScaffoldConfig,
}
);