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

Feature Request: Ability to specify working-directory #65

Closed
sfgeorge opened this issue Mar 27, 2022 · 3 comments · Fixed by #76
Closed

Feature Request: Ability to specify working-directory #65

sfgeorge opened this issue Mar 27, 2022 · 3 comments · Fixed by #76
Labels
kind/enhancement New feature or request kind/upstream

Comments

@sfgeorge
Copy link

sfgeorge commented Mar 27, 2022

Behaviour

tl;dr I can get docker buildx bake to succeed only when I cd to the subdirectory where docker-compose.yml. Can I similarly invoke a change of working directory with bake-action?

By having the ability to change the working directory, one would have a suitable workaround to the following issue in buildx

docker/buildx#1028

Steps to reproduce this issue

Given the following project directory structure:

tests/docker-compose.yml
tests/dockerfiles/debian8/Dockerfile
tests/dockerfiles/debian9/Dockerfile
tests/dockerfiles/debian10/Dockerfile

And the following workflow:

name: CI
on:
  push:
  pull_request:

jobs:
  tests:

    runs-on: ubuntu-latest

    defaults:
      run:
        working-directory: tests

    steps:
      - uses: actions/checkout@v3

      - name: Build
        uses: docker/bake-action@v1.7.0
        with:
          files: tests/docker-compose.yml

And the following tests/docker-compose.yml file

version: "3"
services:
  debian8:
    build: ./dockerfiles/debian8
    cap_add: [ALL]
  debian9:
    build: ./dockerfiles/debian9
    cap_add: [ALL]
  debian10:
    build: ./dockerfiles/debian10
    cap_add: [ALL]

When a build definition file is specified in a subdirectory of the project such as above

Then resolution of Dockerfiles fails.

This is an issue with docker buildx bake itself, not bake-action:

docker buildx bake -f  tests/docker-compose.yml
[+] Building 0.0s (0/0)
error: unable to prepare context: path "dockerfiles/debian9" not found

However, with docker buildx bake there is at least a workaround – Simply first change the working directory to be that of where the build definition file exists.

cd tests && docker buildx bake
cd tests && docker buildx bake
[+] Building 1.4s (23/23) FINISHED
# (output omitted)

Expected behaviour

bake-action should allow one to control the current working directory from which docker buildx bake is invoked.

Configuration

Logs

Download the log file of your build
and attach it to this issue.

logs_28.zip

@tuler
Copy link
Contributor

tuler commented Jun 10, 2022

Hey @crazy-max opened a PR for this, any chance of getting approved?

@mykiwi
Copy link

mykiwi commented Jul 8, 2022

👋, any updates about the PR?

@tuler
Copy link
Contributor

tuler commented Jul 8, 2022

I just updated the PR. Waiting for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request kind/upstream
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants