Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,30 @@ jobs:

- name: Checkout Dockerized
uses: actions/checkout@v2
with:
path: dockerized

- run: bin/dockerized --help
- run: dockerized/bin/dockerized --help
shell: bash

- run: bin/dockerized go version
- run: dockerized/bin/dockerized go version
shell: bash

- name: "Test: version from environment variable"
run: GO_VERSION=1.16.15 bin/dockerized go version | grep "go1.16.15"
run: GO_VERSION=1.16.15 dockerized/bin/dockerized go version | grep "go1.16.15"
shell: bash

- name: "Test: version from dockerized.env"
run: |
mkdir -p project
cd project
echo 'GO_VERSION=1.17.8' > dockerized.env
../bin/dockerized go version | grep "1.17.8"
../dockerized/bin/dockerized go version | grep "1.17.8"
shell: bash

- name: "Test: command that requires building (protoc)"
run: dockerized/bin/dockerized protoc --version
shell: bash

# region windows
- if: runner.os == 'windows'
Expand Down
18 changes: 13 additions & 5 deletions lib/dockerized.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ func main() {

dockerizedRoot := getDockerizedRoot()
dockerizedDockerComposeFilePath := os.Getenv("COMPOSE_FILE")
if dockerizedDockerComposeFilePath != "" {
if optionVerbose {
fmt.Println("COMPOSE_FILE: ", dockerizedDockerComposeFilePath)
}
} else {
if dockerizedDockerComposeFilePath == "" {
dockerizedDockerComposeFilePath = filepath.Join(dockerizedRoot, "docker-compose.yml")
}

if optionVerbose {
fmt.Println("Dockerized docker-compose file: ", dockerizedDockerComposeFilePath)
}

if commandName == "" || optionHelp {
err := help(dockerizedDockerComposeFilePath)
if err != nil {
Expand Down Expand Up @@ -356,6 +356,10 @@ func getBackend() (*api.ServiceProxy, error) {

func dockerComposeBuild(dockerComposeFilePath string, buildOptions api.BuildOptions) error {
project, err := getProject(dockerComposeFilePath)
err = os.Chdir(project.WorkingDir)
if err != nil {
return err
}
if err != nil {
return err
}
Expand All @@ -369,6 +373,10 @@ func dockerComposeBuild(dockerComposeFilePath string, buildOptions api.BuildOpti
}

func dockerComposeRun(project *types.Project, runOptions api.RunOptions, volumes []types.ServiceVolumeConfig) error {
err := os.Chdir(project.WorkingDir)
if err != nil {
return err
}
ctx, _ := newSigContext()

serviceName := runOptions.Service
Expand Down