Skip to content

[Feature Request] flatten command for monorepo docker builds #729

Description

@theoephraim

Description

In a monorepo, you may be importing .env files from other services. When you go to do a docker build that does not include the whole monorepo, now those imported files are missing.

Provide a new varlock flatten command which loads the entire graph, and spits out a new file (or files) that moves imported files into the local directory. This is intended to be used as part of a docker build process, so the user does not have to manually copy those files.

Some complexities to consider:

  • import loading can be dependent on certain values
  • plugins may be installed in an imported project but not in the flatten root

The alternative is to manually copy these files, for example:

# varlock schema tree
# apps/web schema: @import(../../.env.schema) → resolves to /app/.env.schema ✓
COPY --from=builder /app/.env.schema                           ./
COPY --from=builder /app/.env.ports                            ./
COPY --from=builder /app/apps/${SERVICE_DIR}/.env.schema      ./apps/${SERVICE_DIR}/
COPY --from=builder /app/apps/${SERVICE_DIR}/.env.production  ./apps/${SERVICE_DIR}/

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions