Skip to content

Improve makefile situation #99

@tonistiigi

Description

@tonistiigi

A couple of issues with Makefiles in this repo:

The first issue is that they are full of @ output suppression. A lot of the targets execute for a long time and I can't see what is happening or if anything is stuck. Also docker build uses -q for some reason.

The other problem is the duplication of content in multiple Makefiles and aggressive use of mounts. Bind mounts break all cases when building against a remote API and they are almost never needed. By not using mounts you have similar performance and better caching. Similarily I see no reason to define these local duplicate targets that can easily go out of sync and have no guarantees of correctness as they rely on the state of host system. By looking at issues in this repo there are already multiple reports of these problems showing up.

My proposal is:

  • Replace Makefile with docker.Makefile
  • Add a build target that copies artifacts back to the host to keep the current behavior. GOOS can be sent with a build arg.
  • Same for vendor and go generate target
  • Build step should run as part of a Dockerfile not in a separate container. Target stages can be used to build without tests or get devenv.
  • Dev-env target can keep using the mounts(for now)
  • Separate Dockerfile for CI should not be needed. At least after ci supports multi-stage builds if we want to use some better syntax for the local version.

@dnephin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions