include images instead of single image

This commit is contained in:
rmanach 2025-04-08 16:14:58 +02:00
parent 6c656da951
commit 480d2875c2
2 changed files with 9 additions and 9 deletions

View File

@ -99,8 +99,8 @@ func (sd *SwarmDeployer) Build() error {
log.Info().Msg("building swarm archive for deployment...") log.Info().Msg("building swarm archive for deployment...")
filesToArchive := []string{} filesToArchive := []string{}
if imageName := sd.project.ImageName; imageName != "" { for idx := range sd.project.ImageNames {
tarFile, err := sd.dcli.Save(imageName, sd.project.Dir) tarFile, err := sd.dcli.Save(sd.project.ImageNames[idx], sd.project.Dir)
if err != nil { if err != nil {
sd.setDone(err) sd.setDone(err)
return err return err
@ -113,7 +113,7 @@ func (sd *SwarmDeployer) Build() error {
return err return err
} }
log.Info().Str("image", imageName).Msg("image added to archive") log.Info().Str("image", sd.project.ImageNames[idx]).Msg("image added to archive")
} }
if envFilePath := sd.project.Deps.EnvFile; envFilePath != "" { if envFilePath := sd.project.Deps.EnvFile; envFilePath != "" {
@ -162,8 +162,8 @@ func (sd *SwarmDeployer) Deploy() error {
log.Info().Str("archive", sd.archivePath).Msg("deploying archive to swarm...") log.Info().Str("archive", sd.archivePath).Msg("deploying archive to swarm...")
if sd.project.ImageName != "" { for idx := range sd.project.ImageNames {
if _, err := sd.conn.Execute("docker image load -i " + sd.project.ImageName + ".tar"); err != nil { if _, err := sd.conn.Execute("docker image load -i " + sd.project.ImageNames[idx] + ".tar"); err != nil {
return err return err
} }
} }

View File

@ -55,10 +55,10 @@ func getFileInfo(baseDir, filePath string) (string, fs.FileInfo, error) {
// Project handles the details and file informations of your project. // Project handles the details and file informations of your project.
type Project struct { type Project struct {
Name string `json:"name"` Name string `json:"name"`
Dir string Dir string
ImageName string `json:"image"` ImageNames []string `json:"images"`
Deps struct { Deps struct {
EnvFile string `json:"env"` EnvFile string `json:"env"`
EnvFileInfo fs.FileInfo EnvFileInfo fs.FileInfo