Is there a way to set the container build context ...
# 🌱|help-and-getting-started
n
I'm working on a project with the following structure:
Copy code
yml
- repository_A (main project)
  - garden.yml
- repository_B (holds source code for remote action in repo A)
  - rust
    - package_1
       - Dockerfile
    - package_2
       - Dockerfile
When building the Dockerfiles in Garden, it checks out
repository_B
and places it in
.garden
, and then proceeds to attempt the build from the root of
repository_B
. My build action looks something like this:
Copy code
yml
# repository_A/garden.yaml
kind: Build
type: container
name: <name>
spec:
  dockerfile: rust/package_1/Dockerfile
source:
  repository:
    url: <repository_B>
The issue here is that I need to build it from one level further down, in the
rust
subdirectory or the build fails. From what I can find in the docs there doesn't seem to be a straight-forward way to do this. I've tried different variants of
include
with no luck. I could stop using remote actions in favor of remote sources, but this would pollute
repository_B
with garden files though and mess up our ownership boundaries. Is there a way to declare a subdir in the source that I'm missing?
b
Hi @narrow-optician-6866 , do I understand it correctly that you essentially want to specify a source path inside the remote repository? Would it help if we allow you to configure it like this:
Copy code
source:
  path: rust
  repository:
    url: <repository_B>
[I started working on this](https://github.com/garden-io/garden/pull/6750), I'd be happy to get feedback from you if this approach will solve your problem
n
Thanks for following up on this - I'll give it a test run when I have some time, for now we found a work-around (updating all our Dockerfiles to expect the root context). Looks like this would fulfill our requirements though. Thanks! 🙇‍♂️
b
That's great! Thank you for sharing this problem with us, and definitely let us know whenever you encounter problems like that.
The new feature to allow
source.path
with remote actions has been released as part of
0.13.48
by the way
3 Views