How can I create kubernetes type of module but let Garden handle docker image

Hey,
I need to attach my Pod to a Persistent Volume Claim in readOnly mode but that’s not possible with a module of container type, so I’m converting it to kubernetes type. I have a Dockerfile that was used to build a Docker image with kaniko, then the image was uploaded a private GCP Artifact Registry and Pod was created from that image. Now I’d like to have Garden still take care of the building and upload process after moving to kubernetes type of module. How can I set it up?

Hi @dawidstezycki ,

Would it make sense in your situation to add the container module just for the Docker image and make a task for the upload process?

Something like this?

kind: Module
type: container
name: my-service-image
include: [.]        # assuming Dockerfile is in same directory
tasks:
  - name: tag-my-service-image
    command: [sh, -c, "docker tag my-service-image <tags>"]
  - name: upload-my-service-image-gcr
    command: [sh, -c, "docker push <target>"]
---
kind: Module
type: kubernetes
name: my-service
build:
  dependencies: [my-service-image]
manifests:
[...]

Cheers,
Trip

Thanks, we found a solution for the problem that allowed us to get away without volumes

1 Like