Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using built images of one module as base image of another #1329

Closed
zvictor opened this issue Nov 8, 2019 · 4 comments
Closed

using built images of one module as base image of another #1329

zvictor opened this issue Nov 8, 2019 · 4 comments

Comments

@zvictor
Copy link

zvictor commented Nov 8, 2019

according to https://docs.garden.io/guides/configuration-files#build:

name is the required module's name. In many cases you only need to declare the build dependency name. For example, you simply need to build one container before another because it's used as a base image.

I am not sure I got it right. Is it saying that we can use the built image of one module as base image of another? I tried to achieve that but I couldn't figure it out.

Should I just use the module name as image name? If so, how to refer to the correct tag name if the default one, latest, is not generated by garden?


This is what I tried:

Stack Graph

1573231356-83e4da890ec8951adb9573bf9aefa84a

backend/Dockerfile and fronted/Dockerfile

FROM mylib AS base
...

error

Sending build context to Docker daemon  286.2kB
Step 1/24 : FROM mylib AS base
pull access denied for mylib, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

Note: I am posting it here instead of a question in stackoverflow because I believe that this issue could lead to an improvement in the docs or examples folder.

@eysi09
Copy link
Collaborator

eysi09 commented Nov 8, 2019

Hi @zvictor

This example demonstrates how to use base images: https://github.com/garden-io/go3dprint/

For example, the render module uses the base image from the base-image module. Here's the relevant garden.yml config:

# render/garden.yml
kind: Module
name: render
type: container
build:
  dependencies: [base-image]
buildArgs:
  BASE_IMAGE_VERSION: ${modules.base-image.version}

and here's the Dockerfile:

# render/Dockerfile
ARG BASE_IMAGE_VERSION
FROM base-image:${BASE_IMAGE_VERSION}

COPY testfile.test ./

@eysi09
Copy link
Collaborator

eysi09 commented Nov 10, 2019

Closing this. Feel free to re-open if you have any more questions.

@eysi09 eysi09 closed this as completed Nov 10, 2019
@zvictor
Copy link
Author

zvictor commented Nov 11, 2019

that's exactly what I was looking for! thank you!

regarding the documentation, is there anything we could do to make this feature more prominent ? I couldn't find the go3dprint example inside the examples folder and it didn't come to my mind I could find it somewhere else.

@eysi09
Copy link
Collaborator

eysi09 commented Nov 11, 2019

You're absolutely right. This should just be in our main examples directory (or a simplified version). It's originally for an example we did for a talk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants