#Dagger volume is taking more than 300 gb

1 messages · Page 1 of 1 (latest)

quartz raven
#

After few build my dagger volume is very heavy so i need to do :

DAGGER_ENGINE_DOCKER_CONTAINER="$(docker container list --all --filter 'name=^dagger-engine-*' --format '{{.Names}}')"
docker container stop "$DAGGER_ENGINE_DOCKER_CONTAINER"
docker container rm "$DAGGER_ENGINE_DOCKER_CONTAINER"
docker volume prune -f```
at least one a day !

Ex after 2 hours 
I dont use cache in my dagger pipelines
long grail
#

you need to either:

  • make better use of caching
  • understand what operations in your pipeline are generating the most disk pressure and use WithMountedTemp so the FS changes are not persisted
#

You can also configure the engine to use fewer disk space and start garbage collecting the cache as it gets closer to the max specified size

quartz raven
#

i have function like this one

func (m *Wico) BuildEnv(source *Directory) *Container{
    container := dag.Container().
        From("klemensgalus/testphp:latest").
        WithDirectory("/src", source).
        WithWorkdir("/src").
        WithExec([]string{"rm", "-rf", ".git"}).
    
        WithEnvVariable("COMPOSER_ALLOW_SUPERUSER", "1").
        WithExec([]string{"composer", "install","--no-dev", "--optimize-autoloader", "--no-scripts"})
    return container
}

It pull a custom php image (1.6Gb)
But can i cache this ?

#

After its only secrets decrypt or unit test so it doenst take disk pressure !
(If you have doc on WithMountedTemp and the garbage collector i'll take it)

quartz raven
# long grail you need to either: - make better use of caching - understand what operations ...

If i take a full exemple :

func (m *Wico) BuildEnvTest(source *Directory) *Container{
    container := dag.Container().
        From("klemensgalus/testphp:latest").
        WithDirectory("/src", source).
        WithWorkdir("/src").
        WithExec([]string{"rm", "-rf", ".git"}).
    
        WithEnvVariable("COMPOSER_ALLOW_SUPERUSER", "1").
        WithExec([]string{"composer", "install", "--optimize-autoloader", "--no-scripts"})
    return container
}
func (m *Wico) Database(dbName string) *Service {
    container := dag.Container().
        From("postgis/postgis:14-3.4-alpine").
        WithEnvVariable("POSTGRES_USER", "admin").
        WithEnvVariable("POSTGRES_PASSWORD", "admin").
        WithEnvVariable("POSTGRES_DB", dbName).
        WithExposedPort(5432)
    return container.AsService()
}
func(m *Wico) UnitTestingW4B(ctx context.Context, source *Directory)(string, error){
    db := m.Database("dev_test")

    test := m.BuildEnvTest(source).
        WithServiceBinding("db", db).
        WithEnvVariable("DATABASE_URL", "postgresql://admin:admin@db:5432/dev").
        WithExec([]string{"rm", ".env"}).
        WithExec([]string{"cp", ".env.test", ".env"})
    return test.
        WithExec([]string{"php","-d","memory_limit=-1", "bin/console", "doctrine:database:drop", "-n" ,"--force","--env=test", "--if-exists"}).
        WithExec([]string{"php","-d","memory_limit=-1", "bin/console", "doctrine:database:create", "-n","--env=test"}).
        WithExec([]string{"php","-d","memory_limit=-1", "bin/console", "doctrine:query:sql", "-n", "CREATE EXTENSION IF NOT EXISTS postgis;","--env=test"}).
        WithExec([]string{"php","-d","memory_limit=-1", "bin/console", "lexik:jwt:generate-keypair", "-n", "--overwrite","--env=test"}).
        WithExec([]string{"php","-d","memory_limit=-1","bin/console" ,"doctrine:schema:update" ,"-n", "--force","--env=test"}).
        WithExec([]string{"php","-d","memory_limit=-1","vendor/bin/phpunit", "tests/WTEST", "--stop-on-failure"}).

        Stdout(ctx)
}
quartz raven
#

Ok i tryed this : ```go
func(m *Wico) UnitTestingW4B(ctx context.Context, source *Directory)(string, error){

test := m.BuildEnvTest(source).
    WithServiceBinding("db", m.Database("dev_test")).
    WithEnvVariable("DATABASE_URL", "postgresql://admin:admin@db:5432/dev").
    WithExec([]string{"rm", ".env"}).
    WithExec([]string{"cp", ".env.test", ".env"})
return test.
    WithExec([]string{"php","-d","memory_limit=-1", "bin/console", "doctrine:database:drop", "-n" ,"--force","--env=test", "--if-exists"}).
    WithExec([]string{"php","-d","memory_limit=-1", "bin/console", "doctrine:database:create", "-n","--env=test"}).
    WithExec([]string{"php","-d","memory_limit=-1", "bin/console", "doctrine:query:sql", "-n", "CREATE EXTENSION IF NOT EXISTS postgis;","--env=test"}).
    WithExec([]string{"php","-d","memory_limit=-1", "bin/console", "lexik:jwt:generate-keypair", "-n", "--overwrite","--env=test"}).
    WithExec([]string{"php","-d","memory_limit=-1","bin/console" ,"doctrine:schema:update" ,"-n", "--force","--env=test"}).
    WithExec([]string{"php","-d","memory_limit=-1","vendor/bin/phpunit", "tests/test", "--stop-on-failure"}).
    WithMountedTemp("/").
    Stdout(ctx)

}