Skip to content

Building local docker containers with make docker-build is broken #8

@alexlovelltroy

Description

@alexlovelltroy

I am running into an error with make docker-build because the binary is not found:

$ make docker-build
docker build -t boot-service:latest .
STEP 1/8: FROM gcr.io/distroless/static-debian12:nonroot
Trying to pull gcr.io/distroless/static-debian12:nonroot...
Getting image source signatures
Copying blob 7c12895b777b done   | 
Copying blob 526604835308 done   | 
Copying blob ef49c20a7b35 done   | 
Copying blob 990a9c434e5e done   | 
Copying blob 2780920e5dbf done   | 
Copying blob bf7a4185f015 done   | 
Copying blob 3214acf345c0 done   | 
Copying blob 52630fc75a18 done   | 
Copying blob dd64bf2dd177 done   | 
Copying blob b839dfae01f6 done   | 
Copying blob dcaa5a89b0cc done   | 
Copying blob 069d1e267530 done   | 
Copying config 3a59ed7ba5 done   | 
Writing manifest to image destination
STEP 2/8: WORKDIR /app
--> 26cfc71b3d2c
STEP 3/8: COPY boot-service /usr/local/bin/boot-service
Error: building at STEP "COPY boot-service /usr/local/bin/boot-service": checking on sources under "/opt/shared/boot-service": copier: stat: "/boot-service": no such file or directory
make: *** [Makefile:58: docker-build] Error 125

A couple of suggestions:

  1. Generalize container build target (e.g. container-build/container-run), allowing other runtimes other than Docker (e.g. Podman) for builds, as well as specifying tags, etc. (See [1] [2] [3] [4])
  2. Either combine the Dockerfiles or have the container build target use the standalone one.
    • If we want to separate the Goreleaser Dockerfile from the multi-stage build Dockerfile, we should have the container build Make target use the latter. Else if we consolidate the Dockerfiles, we should have the build Make target put the binaries in the repo root and name them (as Goreleaser does, e.g. boot-service and boot-service-client) so the single Dockerfile will find them (we'll also need to make sure the container build target lists the binaries as prerequisites)
    • CoreSMD uses a consolidated Dockerfile. See [4] [5]

Originally posted by @synackd in #7 (comment)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions