Skip to content

Proper CI/CD workflow for Docker deployments (Build-time vs Runtime storage configuration) #896

Description

@nexthis

I'm struggling with implementing a CI/CD pipeline for a NuxtHub application deployed via Docker.

When building the application on the same server where it runs, everything works fine. However, when moving to a CI/CD flow (building a Docker image in a pipeline to be pulled later by the production/test server), I encounter issues with storage drivers.

The Problem

It seems that many configurations for KV, Cache, and Blob are evaluated/baked in during the build process.

  • If the environment variables (like Redis credentials for KV) are not present during nuxt build, the application defaults to the filesystem driver instead of the intended production driver.

  • This makes the Docker image "environment-aware" at build time, which contradicts the "build once, run anywhere" principle of Docker.

Current Behavior

Currently, if REDIS_URL (or similar) is missing during the Docker build phase, the generated Nitro chunks don't seem to switch to the correct remote/production drivers even if those variables are provided later at runtime.

Questions / Clarifications

  1. Is this behavior intended, or is it a limitation of the current integration between NuxtHub and Nitro?
  2. What is the recommended way to handle CI/CD for Docker deployments where the build environment has no access to the production/test databases?
  3. Are there plans to allow more flexible runtime-only configuration for these storage layers without relying on build-time environment detection?

I would appreciate some guidance on whether I should change my CI/CD approach or if there are specific flags/configs to force remote drivers during build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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