@@ -91,10 +91,11 @@ func (m *Ci) Memcached(
9191func (m * Ci ) Test (ctx context.Context , dir * dagger.Directory ) * dagger.Container {
9292
9393 return dag .Container ().
94- From ("ruby:latest" ).
94+ From ("registry.puzzle.ch/docker.io/ruby:3.2" ).
95+ WithExec ([]string {"useradd" , "-m" , "-u" , "1001" , "ruby" }).
9596 WithServiceBinding ("postgresql" , m .Postgres (ctx , "11" )).
9697 WithServiceBinding ("memcached" , m .Memcached (ctx , "latest" )).
97- WithMountedDirectory ("/mnt" , dir ).
98+ WithMountedDirectory ("/mnt" , dir , dagger. ContainerWithMountedDirectoryOpts { Owner : "ruby" } ).
9899 WithWorkdir ("/mnt" ).
99100 WithEnvVariable ("RAILS_DB_HOST" , "postgresql" ). // This is the service name of the postgres container called by rails
100101 WithEnvVariable ("RAILS_TEST_DB_HOST" , "postgresql" ).
@@ -104,14 +105,18 @@ func (m *Ci) Test(ctx context.Context, dir *dagger.Directory) *dagger.Container
104105 WithEnvVariable ("RAILS_ENV" , "test" ).
105106 WithEnvVariable ("CI" , "true" ).
106107 WithEnvVariable ("PGDATESTYLE" , "German" ).
108+ WithEnvVariable ("TZ" , "Europe/Zurich" ).
109+ WithEnvVariable ("DEBIAN_FRONTEND" , "noninteractive" ).
107110 WithExec ([]string {"apt-get" , "update" }).
108- WithExec ([]string {"apt-get" , "-yqq" , "install" , "libpq-dev" , "libvips-dev" }).
109- WithExec ([]string {"gem" , "install" , "bundler" , "--version" , "~> 2" }).
111+ WithExec ([]string {"apt-get" , "-yqq" , "install" , "libpq-dev" , "libvips-dev" , "chromium" , "graphviz" , "imagemagick" }).
112+ WithUser ("ruby" ).
113+ WithExec ([]string {"gem" , "update" , "--system" }). // update bundler version
114+ WithExec ([]string {"gem" , "install" , "bundler" , "--version" , `~>2` }).
110115 WithExec ([]string {"bundle" , "install" , "--jobs" , "4" , "--retry" , "3" }).
111116 WithExec ([]string {"bundle" , "exec" , "rails" , "db:create" }).
112117 WithExec ([]string {"bundle" , "exec" , "rails" , "db:migrate" }).
113118 WithExec ([]string {"bundle" , "exec" , "rails" , "assets:precompile" }).
114- WithExec ([]string {"bundle" , "exec" , "rails" , "test" })
119+ WithExec ([]string {"bundle" , "exec" , "rails" , "test" , "test/controllers" , "test/domain" , "test/fabricators" , "test/fixtures" , "test/helpers" , "test/mailers" , "test/models" , "test/presenters" , "test/support" , "test/tarantula" })
115120}
116121
117122// Creates an SBOM for the container
0 commit comments