build(lint): properly cleanup container, speed up stopping
All checks were successful
Test / elint (push) Successful in 38s
All checks were successful
Test / elint (push) Successful in 38s
This commit is contained in:
parent
c4274316fa
commit
dad55b6193
2 changed files with 3 additions and 3 deletions
|
@ -93,7 +93,7 @@ func ValidateManifest(stdout, stderr io.Writer, overlayDir, packageName string)
|
||||||
ctx := context.TODO()
|
ctx := context.TODO()
|
||||||
|
|
||||||
bid, err := exec.Command(
|
bid, err := exec.Command(
|
||||||
"docker", "run", "-d", "--rm", "--entrypoint", "sleep", gentooImage, "infinity",
|
"docker", "run", "--init", "-d", "--rm", "--entrypoint", "sleep", gentooImage, "infinity",
|
||||||
).Output()
|
).Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
var execErr *exec.ExitError
|
var execErr *exec.ExitError
|
||||||
|
@ -104,7 +104,7 @@ func ValidateManifest(stdout, stderr io.Writer, overlayDir, packageName string)
|
||||||
return fmt.Errorf("failed to run container: %w", err)
|
return fmt.Errorf("failed to run container: %w", err)
|
||||||
}
|
}
|
||||||
containerID := strings.TrimSpace(string(bid))
|
containerID := strings.TrimSpace(string(bid))
|
||||||
defer exec.Command("docker", "stop", containerID) //nolint:errcheck // Why: best effort
|
defer exec.Command("docker", "stop", containerID).Run() //nolint:errcheck // Why: best effort
|
||||||
|
|
||||||
lclPkgDir := filepath.Join(overlayDir, packageName)
|
lclPkgDir := filepath.Join(overlayDir, packageName)
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ func (e *Executor) Run(ctx context.Context) (*Results, error) {
|
||||||
// TODO(jaredallard): Use the Docker API for this, but for now the CLI
|
// TODO(jaredallard): Use the Docker API for this, but for now the CLI
|
||||||
// is much better.
|
// is much better.
|
||||||
bid, err := exec.Command(
|
bid, err := exec.Command(
|
||||||
"docker", "run", "-d", "--rm", "--entrypoint", "sleep",
|
"docker", "run", "--init", "-d", "--rm", "--entrypoint", "sleep",
|
||||||
"ghcr.io/jaredallard/overlay:updater", "infinity",
|
"ghcr.io/jaredallard/overlay:updater", "infinity",
|
||||||
).Output()
|
).Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue