Documentation
¶
Index ¶
- Variables
- type B2Config
- type BuildConfig
- type BuildResult
- type BuildService
- func (s *BuildService) Build(ctx context.Context, spec *BuildSpec) (*BuildResult, error)
- func (s *BuildService) Cleanup() error
- func (s *BuildService) GetSecret(ctx context.Context, source string) (string, error)
- func (s *BuildService) SetB2Config(config *B2Config)
- func (s *BuildService) StartBuildAsync(ctx context.Context, buildID string, buildSpecYAML string, ...) error
- type BuildSpec
- type BuildStep
- type CodebaseConfig
- type ComposeBuild
- type ComposeProject
- type ComposeService
- type DetectedEcosystem
- type DummySecretFetcher
- type HealthCheck
- type ResourceConfig
- type RunConfigDef
- type RunService
- type RunYAML
- type SecretFetcher
- type SecretSpec
- type ServiceOutput
Constants ¶
This section is empty.
Variables ¶
var ( ErrAmbiguousEcosystem = errors.New("multiple incompatible major ecosystems detected (e.g., Go and Rust). Cannot auto-resolve") ErrNoEcosystemFound = errors.New("no supported ecosystem found (e.g., go.mod, package.json, Cargo.toml) at project root") ErrNoTemplateFound = errors.New("no Dockerfile template found for the detected ecosystem") )
var DockerfileTemplates = map[string]string{
"Go-go": `
# --- Build Stage ---
# Utiliser une image Go spécifique (ajuster la version au besoin)
# ARG GOLANG_VERSION=1.21
# FROM golang:${GOLANG_VERSION}-alpine AS builder
FROM golang:1.21-alpine AS builder
# Définir le répertoire de travail
WORKDIR /app
# Installer les outils nécessaires (optionnel, ex: pour CGO)
# RUN apk add --no-cache gcc libc-dev
# Télécharger les dépendances séparément pour profiter du cache Docker
# Copier go.mod et go.sum (et go.work/go.work.sum si pertinent)
COPY go.* ./
# RUN go work sync # Décommenter si go.work est utilisé
RUN go mod download
# Copier le reste du code source
COPY . .
# Compiler l'application
# Utiliser -ldflags="-w -s" pour réduire la taille du binaire final (optionnel)
# Utiliser CGO_ENABLED=0 pour une compilation statique si possible (pas de dépendances C)
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o /app/main .
# --- Final Stage ---
# Utiliser une image minimale (alpine est petite, distroless est encore plus minimal)
# FROM gcr.io/distroless/static-debian11 AS final # Pour binaire statique (CGO_ENABLED=0)
FROM alpine:latest AS final
# Créer un utilisateur non-root pour la sécurité
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
WORKDIR /app
# Copier le binaire compilé depuis l'étape de build
COPY --from=builder /app/main .
# Copier les assets statiques ou fichiers de configuration si nécessaire
# COPY --from=builder /app/templates ./templates
# COPY --from=builder /app/static ./static
# COPY config.yaml .
# Port exposé par l'application (ajuster si nécessaire)
EXPOSE 8080
# Commande pour lancer l'application
CMD ["./main"]
# Note: N'oubliez pas de créer un fichier .dockerignore efficace !
# Exclure .git, tmp/, *.log, .vscode/, etc. et potentiellement le binaire 'main' local.
`,
"JavaScript-npm": `
# --- Build Stage ---
# Utiliser une image Node spécifique (ajuster la version LTS ou autre)
# ARG NODE_VERSION=18
# FROM node:${NODE_VERSION}-alpine AS builder
FROM node:18-alpine AS builder
WORKDIR /app
# Copier package.json et package-lock.json (ou npm-shrinkwrap.json)
COPY package*.json ./
# Installer les dépendances (npm ci est recommandé pour la reproductibilité)
# Utilisation du cache mount de BuildKit pour accélérer les installs répétés
RUN --mount=type=cache,target=/root/.npm \
npm ci --only=production --ignore-scripts --prefer-offline --no-audit
# Copier le reste du code source de l'application
COPY . .
# Optionnel: Exécuter le script de build (ex: pour TypeScript, React, Vue, etc.)
# Assurez-vous que les devDependencies sont installées si nécessaire pour le build
# Si besoin de devDependencies:
# RUN --mount=type=cache,target=/root/.npm npm ci --ignore-scripts --prefer-offline --no-audit
# RUN npm run build
# --- Final Stage ---
FROM node:18-alpine AS final
WORKDIR /app
# Créer un utilisateur non-root
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
# Copier les dépendances installées et le code source depuis le builder
# Important: Assurer que les permissions sont correctes pour l'utilisateur non-root
COPY --from=builder --chown=appuser:appgroup /app /app
USER appuser
# Port exposé par l'application
EXPOSE 3000
# Commande pour lancer l'application (ajuster selon votre point d'entrée)
CMD ["node", "votre-fichier-main.js"] # ou "server.js", "dist/main.js", etc.
# Note: Utilisez un .dockerignore ! Excluez node_modules, .git, *.log, dist/, build/ etc.
`,
"JavaScript-yarn": `
# --- Build Stage ---
# ARG NODE_VERSION=18
# FROM node:${NODE_VERSION}-alpine AS builder
FROM node:18-alpine AS builder
WORKDIR /app
# Copier package.json et yarn.lock
COPY package.json yarn.lock ./
# Installer les dépendances (yarn install --frozen-lockfile est recommandé)
# Utilisation du cache mount de BuildKit pour Yarn v1 (cache par défaut) ou v2+ (ajuster le target)
# Pour Yarn v1: /usr/local/share/.cache/yarn/v6
# Pour Yarn v2+ (PnP/node_modules): .yarn/cache ou node_modules/.yarn-cache
# Vérifiez votre configuration Yarn Berry. Ici on suppose Yarn v1 ou v2+ avec node_modules linker.
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn/v6 \
yarn install --frozen-lockfile --production --ignore-scripts --prefer-offline
# Copier le reste du code source
COPY . .
# Optionnel: Exécuter le script de build
# Si besoin de devDependencies:
# RUN --mount=type=cache,target=/usr/local/share/.cache/yarn/v6 yarn install --frozen-lockfile --ignore-scripts --prefer-offline
# RUN yarn build
# --- Final Stage ---
FROM node:18-alpine AS final
WORKDIR /app
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
COPY --from=builder --chown=appuser:appgroup /app /app
USER appuser
EXPOSE 3000
CMD ["node", "votre-fichier-main.js"]
# Note: Utilisez un .dockerignore ! (node_modules, .yarn/, .git, *.log, etc.)
`,
"JavaScript-pnpm": `
# --- Build Stage ---
# ARG NODE_VERSION=18
# FROM node:${NODE_VERSION}-alpine AS builder
FROM node:18-alpine AS builder
# Installer pnpm globalement dans l'image de build
RUN npm install -g pnpm
WORKDIR /app
# Copier les fichiers de dépendances
COPY package.json pnpm-lock.yaml ./
# Copier .npmrc s'il existe (peut contenir des configurations de registry)
# COPY .npmrc .
# Installer les dépendances (--frozen-lockfile est implicite avec pnpm-lock.yaml)
# Utilisation du cache mount de BuildKit pour le store pnpm (par défaut ~/.pnpm-store)
RUN --mount=type=cache,target=/root/.pnpm-store \
pnpm install --prod --prefer-offline --ignore-scripts
# Copier le reste du code source
COPY . .
# Optionnel: Exécuter le script de build
# Si besoin de devDependencies:
# RUN --mount=type=cache,target=/root/.pnpm-store pnpm install --prefer-offline --ignore-scripts
# RUN pnpm build
# --- Final Stage ---
# Il est crucial de copier correctement le store pnpm ou les node_modules
# Stratégie 1: Copier tout le répertoire /app (simple mais peut être gros)
FROM node:18-alpine AS final
WORKDIR /app
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
COPY --from=builder --chown=appuser:appgroup /app /app
USER appuser
EXPOSE 3000
CMD ["node", "votre-fichier-main.js"]
# Stratégie 2 (plus complexe, pour optimiser la taille): Utiliser 'pnpm deploy'
# FROM node:18-alpine AS builder
# ... (installations comme avant) ...
# RUN pnpm build # Si nécessaire
# RUN pnpm prune --prod # Optionnel, supprime les devDeps si elles ont été installées
# RUN pnpm deploy /prod_app --prod # Crée un répertoire avec seulement les deps de prod
#
# FROM node:18-alpine AS final
# WORKDIR /app
# RUN addgroup -S appgroup && adduser -S appuser -G appgroup
# COPY --from=builder --chown=appuser:appgroup /prod_app /app # Copier le résultat de deploy
# USER appuser
# EXPOSE 3000
# CMD ["node", "votre-fichier-main.js"]
# Note: Utilisez un .dockerignore ! (node_modules, .git, *.log, etc.)
`,
"Rust-cargo": `
# --- Build Stage (Planner) ---
# Utiliser l'image Rust officielle (ajuster version/toolchain)
# FROM rust:1.70-slim AS planner
FROM rust:1.70-slim AS planner
WORKDIR /app
# Copier uniquement les manifestes Cargo
COPY Cargo.toml Cargo.lock* ./
# Copier les manifestes des workspaces membres si nécessaire
# COPY members/*/Cargo.toml ./members/*/
# Créer un projet factice pour pré-compiler les dépendances
# Cela évite de recompiler les dépendances si seul le code src/ change
RUN mkdir src && echo "fn main() {}" > src/main.rs
# Compiler uniquement les dépendances (sans cache mount pour cette étape simple)
RUN cargo build --release --locked
# --- Build Stage (Builder) ---
# FROM rust:1.70-slim AS builder
FROM rust:1.70-slim AS builder
WORKDIR /app
# Copier les dépendances pré-compilées du planner
COPY --from=planner /app/target ./target
COPY --from=planner /usr/local/cargo/registry /usr/local/cargo/registry
COPY Cargo.toml Cargo.lock* ./
# COPY members/*/Cargo.toml ./members/*/
# Copier le code source réel
COPY src ./src
# COPY members/*/src ./members/*/
# Compiler le projet final
# Utilisation du cache mount de BuildKit pour le cache de compilation incrémentale
RUN --mount=type=cache,target=/app/target \
--mount=type=cache,target=/usr/local/cargo/registry \
cargo build --release --locked
# --- Final Stage ---
# Utiliser une image minimale. Debian slim est un bon compromis.
# Alpine peut nécessiter musl-tools si vous avez des dépendances C.
FROM debian:bullseye-slim AS final
# FROM alpine:latest AS final # Si compatible musl
# RUN apk add --no-cache musl-tools # Si Alpine et besoin de C
WORKDIR /app
# Créer un utilisateur non-root
RUN groupadd -r appgroup && useradd --no-log-init -r -g appgroup appuser
USER appuser
# Copier le binaire compilé
COPY --from=builder /app/target/release/your_binary_name ./ # Remplacez your_binary_name !
# Port exposé (ajuster)
EXPOSE 8000
# Commande de lancement
CMD ["./your_binary_name"]
# Note: .dockerignore est crucial ! (target/, .git, etc.)
`,
"Python-Pip": `
# --- Build Stage ---
# Utiliser une image Python officielle (ajuster version)
# ARG PYTHON_VERSION=3.11
# FROM python:${PYTHON_VERSION}-slim AS builder
FROM python:3.11-slim AS builder
WORKDIR /app
# Installer les dépendances système si nécessaire (ex: pour psycopg2, Pillow)
# RUN apt-get update && apt-get install -y --no-install-recommends \
# build-essential libpq-dev \
# && rm -rf /var/lib/apt/lists/*
# Créer un environnement virtuel
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Mettre à jour pip et installer wheel
RUN pip install --upgrade pip wheel
# Copier le fichier de dépendances
COPY requirements.txt .
# Installer les dépendances dans l'environnement virtuel
# Utilisation du cache mount de BuildKit pour le cache pip
RUN --mount=type=cache,target=/root/.cache/pip \
pip install --no-cache-dir -r requirements.txt
# Copier le reste du code source
COPY . .
# --- Final Stage ---
# FROM python:${PYTHON_VERSION}-slim AS final
FROM python:3.11-slim AS final
WORKDIR /app
# Créer un utilisateur non-root
RUN groupadd -r appgroup && useradd --no-log-init -r -g appgroup appuser
# Copier l'environnement virtuel créé dans l'étape de build
COPY --from=builder /opt/venv /opt/venv
# Copier le code de l'application
COPY --chown=appuser:appgroup . /app
# Définir le PATH pour inclure l'environnement virtuel
ENV PATH="/opt/venv/bin:$PATH"
# Empêcher Python d'écrire des fichiers .pyc
ENV PYTHONDONTWRITEBYTECODE 1
# Assurer que Python tourne en mode non-bufferisé (bon pour les logs)
ENV PYTHONUNBUFFERED 1
USER appuser
# Port exposé (ajuster)
EXPOSE 8000
# Commande de lancement (ajuster selon votre application: gunicorn, uvicorn, python main.py)
# CMD ["gunicorn", "-b", "0.0.0.0:8000", "your_project.wsgi:application"]
CMD ["python", "your_main_script.py"]
# Note: .dockerignore (venv/, __pycache__/, .git, *.log, *.db, etc.)
`,
"Java-Maven": `
# --- Build Stage ---
# Utiliser une image Maven avec un JDK spécifique (ajuster versions)
# ARG MAVEN_VERSION=3.8
# ARG JDK_VERSION=17
# FROM maven:${MAVEN_VERSION}-eclipse-temurin-${JDK_VERSION}-alpine AS builder
FROM maven:3.8-eclipse-temurin-17-alpine AS builder
WORKDIR /app
# Copier le fichier pom.xml
COPY pom.xml .
# Télécharger les dépendances Maven
# Utilisation du cache mount de BuildKit pour le dépôt local Maven (.m2)
RUN --mount=type=cache,target=/root/.m2 \
mvn dependency:go-offline -B
# Copier le code source
COPY src ./src
# Compiler et packager l'application (ex: en JAR ou WAR)
# Le cache mount ici accélère la compilation si les sources n'ont pas changé
RUN --mount=type=cache,target=/root/.m2 \
mvn package -B -DskipTests
# --- Final Stage ---
# Utiliser une image JRE minimale (ajuster version et distribution)
# FROM eclipse-temurin:${JDK_VERSION}-jre-alpine AS final
FROM eclipse-temurin:17-jre-alpine AS final
WORKDIR /app
# Créer un utilisateur non-root
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
# Copier l'artefact buildé (JAR/WAR) depuis l'étape de build
# Ajuster le chemin du JAR/WAR selon la configuration de votre pom.xml
COPY --from=builder /app/target/*.jar ./app.jar
# COPY --from=builder /app/target/*.war ./app.war
# Port exposé (ajuster)
EXPOSE 8080
# Commande de lancement (ajuster)
# Pour un JAR exécutable:
CMD ["java", "-jar", "app.jar"]
# Pour un WAR (nécessite un serveur d'application comme Tomcat, non inclus ici)
# CMD ["catalina.sh", "run"] # Si l'image de base était Tomcat
# Note: .dockerignore (target/, .git, .mvn/, *.log, etc.)
`,
}
dockerfileTemplates mappe un identifiant d'écosystème à son template Dockerfile. La clé est généralement "Language-PackageManager" ou "Language-Ecosystem".
Functions ¶
This section is empty.
Types ¶
type B2Config ¶
type B2Config struct {
AccountID string `json:"account_id" yaml:"account_id"`
ApplicationKey string `json:"application_key" yaml:"application_key"`
BucketName string `json:"bucket_name" yaml:"bucket_name"`
BasePath string `json:"base_path" yaml:"base_path"`
}
B2Config is the b2 storage information struct
type BuildConfig ¶
type BuildConfig struct {
BaseImage string `json:"base_image,omitempty" yaml:"base_image,omitempty"` // The base image to use
Dockerfile string `json:"dockerfile,omitempty" yaml:"dockerfile,omitempty"` // relative path of the Dockerfile or the inline content
ComposeFile string `json:"compose_file,omitempty" yaml:"compose_file,omitempty"` // the relative compose file path
Target string `json:"target,omitempty" yaml:"target,omitempty"`
Args map[string]string `json:"args,omitempty" yaml:"args,omitempty"` // Ens vars to inject in the build config
Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"` // Tags for the finale docker image (or the principal image in case of compose)
Platforms []string `json:"platforms,omitempty" yaml:"platforms,omitempty"` // cross-platform support (experimental)
NoCache bool `json:"no_cache,omitempty" yaml:"no_cache,omitempty"` // Specify if the cache will be used between the build
OutputTarget string `json:"output_target" yaml:"output_target"` // The storage target "b2", "local", "docker" (by default)
LocalPath string `json:"local_path,omitempty" yaml:"local_path,omitempty"` // Output path if OutputTarget="local"
Pull bool `json:"pull,omitempty" yaml:"pull,omitempty"` // Trying to pull the based image
BuildKit bool `json:"buildkit,omitempty" yaml:"buildkit,omitempty"` // Use BuildKit (if available)
}
BuildConfig is a Docker build config spec extended
type BuildResult ¶
type BuildResult struct {
Success bool `json:"success"`
ImageID string `json:"image_id,omitempty"` // The docker image ID (if applicable)
ImageIDs map[string]string `json:"image_ids,omitempty"` // Each service IDS (if compose)
ImageSize int64 `json:"image_size,omitempty"` // The main docker image size
ImageSizes map[string]int64 `json:"image_sizes,omitempty"` // Image size by service
Artifacts map[string][]byte `json:"-"` // Memory artefact
BuildTime float64 `json:"build_time"` // Total Build time
ErrorMessage string `json:"error_message,omitempty"` // Build error message
Logs string `json:"logs"` // Build logs
B2ObjectNames []string `json:"b2_object_names,omitempty"` // For OutputTarget="b2"
LocalImagePaths map[string]string `json:"local_image_paths,omitempty"` // For OutputTarget="local"
RunConfigPath string `json:"run_config_path,omitempty"` // Path to the generated *.run.yml file
ServiceOutputs map[string]ServiceOutput `json:"service_outputs,omitempty"` // Specific information generated by service
}
BuildResult is the struct representing a build result of each service
type BuildService ¶
type BuildService struct {
// contains filtered or unexported fields
}
The Main service to manage each build
func NewBuildService ¶
func NewBuildService(workDir string, inMemory bool, secretFetcher SecretFetcher) (*BuildService, error)
Create a new instance of the build service
func (*BuildService) Build ¶
func (s *BuildService) Build(ctx context.Context, spec *BuildSpec) (*BuildResult, error)
Running the build based on the provided spec
func (*BuildService) Cleanup ¶
func (s *BuildService) Cleanup() error
func (*BuildService) SetB2Config ¶
func (s *BuildService) SetB2Config(config *B2Config)
SetB2Config configure the B2 configuration
func (*BuildService) StartBuildAsync ¶
func (s *BuildService) StartBuildAsync(ctx context.Context, buildID string, buildSpecYAML string, notifier socket.BuildNotifier) error
StartBuildAsync lance un build en arrière-plan et notifie via le notifier.
type BuildSpec ¶
type BuildSpec struct {
Name string `json:"name" yaml:"name"` // The Name used for the service
Version string `json:"version" yaml:"version"` // The version of the software can use a semver specification
Codebases []CodebaseConfig `json:"codebases" yaml:"codebases"` // The list of the different codebases. It can be provided by git or local or tar/zip archive
Resources []ResourceConfig `json:"resources,omitempty" yaml:"resources,omitempty"` // A list of the resources to include in build process
BuildSteps []BuildStep `json:"build_steps,omitempty" yaml:"build_steps,omitempty"` // Specify the different build step. Useful for including a binary dependency in any codebase build
BuildConfig BuildConfig `json:"build_config" yaml:"build_config"` // The build Build configuration struct
Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"` // Specify the Environment variables
EnvFiles []string `json:"env_files,omitempty" yaml:"env_files,omitempty"` // Used to load the Envs from the provided file path
Secrets []SecretSpec `json:"secrets,omitempty" yaml:"secrets,omitempty"` // Secrets specifications. Secrets is like env vars but it's provided by a specific service and encrypted/decrypted during the usage. Use this to pass very sensible information to your different services
RunConfigDef RunConfigDef `json:"run_config_def,omitempty" yaml:"run_config_def,omitempty"` // Configuration for the *.run.yml file. This file is used by the CLI to run your different services
}
BuildSpec is the specification structure parsing from the spec file This is the extended config for the build process
func LoadBuildSpecFromBytes ¶
Load the build config from byte array
func LoadBuildSpecFromFile ¶
Load the build config from a file
type BuildStep ¶
type BuildStep struct {
Name string `json:"name" yaml:"name"` // The step name
CodebaseName string `json:"codebase_name" yaml:"codebase_name"` // References a codebase name to use for this step
OutputsBinaryPath string `json:"outputs_binary_path,omitempty" yaml:"outputs_binary_path,omitempty"` // Path in the *container* of the binary to extract
UseBinaryFromStep string `json:"use_binary_from_step,omitempty" yaml:"use_binary_from_step,omitempty"` // The step in which the binary will be used
BinaryTargetPath string `json:"binary_target_path,omitempty" yaml:"binary_target_path,omitempty"` // The path to put the binary during the specific step
}
BuildStep is a build sequenced step, potentially with dependencies
type CodebaseConfig ¶
type CodebaseConfig struct {
Name string `json:"name" yaml:"name"` // Specify the name of the codebase
SourceType string `json:"source_type" yaml:"source_type"` // git, local, archive, buffer
Source string `json:"source" yaml:"source"` // URL, local path
Branch string `json:"branch,omitempty" yaml:"branch,omitempty"` // The git branch to build
Commit string `json:"commit,omitempty" yaml:"commit,omitempty"` // The specific commit to consider during the codebase pulling if the source is git
Path string `json:"path,omitempty" yaml:"path,omitempty"` // The path of the codebase in the local dir
Content []byte `json:"-" yaml:"-"` // The memory content if the source type is buffer
BuildOnly bool `json:"build_only,omitempty" yaml:"build_only,omitempty"` // If specified the codebase is only builded
TargetInHost string `json:"target_in_host,omitempty" yaml:"target_in_host,omitempty"` // Path to put the codebase in the host dir
}
Representation of any codebase in the services
type ComposeBuild ¶
type ComposeBuild struct {
Context string
Dockerfile string
Args map[string]*string
Target string
CacheFrom []string `yaml:"cache_from,omitempty"`
Labels map[string]string `yaml:"labels,omitempty"`
Network string `yaml:"network,omitempty"`
}
func (*ComposeBuild) UnmarshalYAML ¶
func (cb *ComposeBuild) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML handle the case which `build: ./context` and `build: {context: ...}`
type ComposeProject ¶
type ComposeProject struct {
Version string `yaml:"version,omitempty"`
Services map[string]ComposeService `yaml:"services"`
Name string
Volumes map[string]interface{} `yaml:"volumes,omitempty"`
Networks map[string]interface{} `yaml:"networks,omitempty"`
}
func LoadComposeFile ¶
func LoadComposeFile(data []byte) (*ComposeProject, error)
parse a compose file
type ComposeService ¶
type ComposeService struct {
Image string `yaml:"image,omitempty"`
Build *ComposeBuild `yaml:"build,omitempty"`
Command []string `yaml:"command,omitempty"`
Entrypoint []string `yaml:"entrypoint,omitempty"`
Environment map[string]*string `yaml:"environment,omitempty"`
Ports []string `yaml:"ports,omitempty"`
Volumes []string `yaml:"volumes,omitempty"`
DependsOn []string `yaml:"depends_on,omitempty"`
Restart string `yaml:"restart,omitempty"`
HealthCheck *HealthCheck `yaml:"healthcheck,omitempty"`
Labels map[string]string `yaml:"labels,omitempty"`
Expose []string `yaml:"expose,omitempty"`
StopGracePeriod string `yaml:"stop_grace_period,omitempty"`
}
A representation of a compose service (simplified)
type DetectedEcosystem ¶
type DetectedEcosystem struct {
Language string
Ecosystem string
PackageManager string
RootPath string
MainMarkerFile string
}
DetectedEcosystem holds language/ecosystem detection details Compatible with extensible language addition.
func DetectEcosystem ¶
func DetectEcosystem(codebasePath string) (*DetectedEcosystem, error)
DetectEcosystem returns the main detected ecosystem in a project directory
type DummySecretFetcher ¶
type DummySecretFetcher struct{}
Placeholder pour l'implémentation du SecretFetcher si non fourni
type HealthCheck ¶
type HealthCheck struct {
Test []string `yaml:"test,omitempty"`
Interval string `yaml:"interval,omitempty"`
Timeout string `yaml:"timeout,omitempty"`
Retries *int `yaml:"retries,omitempty"`
StartPeriod string `yaml:"start_period,omitempty"`
}
This is a healthcheck simplified struct
type ResourceConfig ¶
type ResourceConfig struct {
URL string `json:"url" yaml:"url"` // The resource URL
TargetPath string `json:"target_path" yaml:"target_path"` // relative path destination in the build dir
Extract bool `json:"extract,omitempty" yaml:"extract,omitempty"` // Extract the archive (tar, tgz, zip)
}
ResourceConfig is resource representation to download during the build
type RunConfigDef ¶
type RunConfigDef struct {
Generate bool `json:"generate" yaml:"generate"` // Is the file will be generated ?
ArtifactStorage string `json:"artifact_storage" yaml:"artifact_storage"` // "docker" (use the tags), "local" (referencing .tar)
Commands []string `json:"commands,omitempty" yaml:"commands,omitempty"` // The default commands (overriding if needed)
}
RunConfigDef define the parameters for the *.run.yml generation
type RunService ¶
type RunService struct {
Image string `yaml:"image"` // The name of the tar local image
Command []string `yaml:"command,omitempty"` // The command to exec
Entrypoint []string `yaml:"entrypoint,omitempty"` // The entry point
Environment map[string]string `yaml:"environment,omitempty"` // Environment variables (include secrets)
Ports []string `yaml:"ports,omitempty"` // Format "host:container"
Volumes []string `yaml:"volumes,omitempty"` // Format "host:container" ou "named:container"
Restart string `yaml:"restart,omitempty"` // Reboot politic (e.g., "always", "on-failure")
DependsOn []string `yaml:"depends_on,omitempty"` // The depending services
}
RunService is any service representation in the *.run.yml
type RunYAML ¶
type RunYAML struct {
Version string `yaml:"version"` // The file version format
Services map[string]RunService `yaml:"services"`
}
RunYAML is the struct of the *.run.yml output file. This file is generated after a build and is used by the bx CLI to run your artifact
type SecretFetcher ¶
type SecretFetcher interface {
GetSecret(ctx context.Context, source string) (string, error) // Must return the secret value
}
Interface for an extern secrets service provider
type SecretSpec ¶
type SecretSpec struct {
Name string `json:"name" yaml:"name"` // The name of the env var that will receive the secret
Source string `json:"source" yaml:"source"` // The service ID for this secret
InjectMethod string `json:"inject_method" yaml:"inject_method"` // "env" (default), can be file later
}
SecretSpec define the way to fetch the secrets
type ServiceOutput ¶
type ServiceOutput struct {
ImageID string `json:"image_id"`
ImageSize int64 `json:"image_size"`
Logs string `json:"logs"`
}
ServiceOutput is the specific information for each builded service (e.g., image ID)