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}/
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 flattencommand 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:
The alternative is to manually copy these files, for example: