Skip to content

Commit

Permalink
fix: #34 pull d3fk/s3cmd image before starting a container
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdan-shulha committed Aug 20, 2024
1 parent 680e316 commit d841653
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions internal/app/ptah-agent/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ import (
"context"
"encoding/json"
"fmt"
"io"
"log"
"strings"
"time"

"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/network"
dockerClient "github.com/docker/docker/client"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
t "github.com/ptah-sh/ptah-agent/internal/pkg/ptah-client"
"io"
"log"
"strings"
"time"
)

func (e *taskExecutor) createS3Storage(ctx context.Context, req *t.CreateS3StorageReq) (*t.CreateS3StorageRes, error) {
Expand Down Expand Up @@ -100,6 +102,12 @@ func (e *taskExecutor) uploadS3FileWithHelper(ctx context.Context, mounts []moun
destFilePath = destFilePath[len(s3StorageSpec.PathPrefix):]
}

// Pull the d3fk/s3cmd image before starting the container
_, err = e.docker.ImagePull(ctx, "d3fk/s3cmd", image.PullOptions{}) // Added underscore to ignore the first return value
if err != nil {
return fmt.Errorf("check s3 storage: pull image: %w", err)
}

createResponse, err := e.docker.ContainerCreate(ctx, &container.Config{
Image: "d3fk/s3cmd",
Entrypoint: []string{
Expand Down

0 comments on commit d841653

Please sign in to comment.