Fix for Dockerfiles when building with GoReleaser#793
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts the Docker build inputs to match GoReleaser’s produced artifact names/locations so Docker images can be built successfully via GoReleaser.
Changes:
- Update Dockerfiles to
COPYbinaries without the.binsuffix. - Update GoReleaser
dockers.extra_filesentries to reference artifacts underdist/.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| deploy/cicd/docker/Dockerfile-osctrl-tls | Update binary name copied into image (drop .bin). |
| deploy/cicd/docker/Dockerfile-osctrl-cli | Update binary name copied into image (drop .bin). |
| deploy/cicd/docker/Dockerfile-osctrl-api | Update binary name copied into image (drop .bin). |
| deploy/cicd/docker/Dockerfile-osctrl-admin | Update binary name copied into image (drop .bin). |
| .goreleaser.yml | Point docker extra_files to dist/ artifacts for each component. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| mkdir -p /opt/osctrl/script && \ | ||
| chown osctrl-${COMPONENT}:osctrl-${COMPONENT} -R /opt/osctrl | ||
| COPY osctrl-${COMPONENT}-${GOOS}-${GOARCH}.bin /opt/osctrl/bin/osctrl-${COMPONENT} | ||
| COPY osctrl-${COMPONENT}-${GOOS}-${GOARCH} /opt/osctrl/bin/osctrl-${COMPONENT} |
There was a problem hiding this comment.
This Dockerfile now copies a binary without the .bin suffix, but the repo’s existing GitHub composite action that builds Docker images prepares the context with osctrl-${component}-${GOOS}-${GOARCH}.bin (see .github/actions/build/docker/action.yml:50-52). Unless that workflow has been retired, this change will make those Docker builds fail. Consider keeping compatibility (e.g., make the suffix configurable via a build-arg) or update the CI action(s) in the same PR.
| mkdir -p /opt/osctrl/script && \ | ||
| chown osctrl-${COMPONENT}:osctrl-${COMPONENT} -R /opt/osctrl | ||
| COPY osctrl-${COMPONENT}-${GOOS}-${GOARCH}.bin /opt/osctrl/bin/osctrl-${COMPONENT} | ||
| COPY osctrl-${COMPONENT}-${GOOS}-${GOARCH} /opt/osctrl/bin/osctrl-${COMPONENT} |
There was a problem hiding this comment.
This Dockerfile now copies a binary without the .bin suffix, but the repo’s existing GitHub composite action that builds Docker images prepares the context with osctrl-${component}-${GOOS}-${GOARCH}.bin (see .github/actions/build/docker/action.yml:50-52). Unless that workflow has been retired, this change will make those Docker builds fail. Consider keeping compatibility (e.g., make the suffix configurable via a build-arg) or update the CI action(s) in the same PR.
| mkdir -p /opt/osctrl/data && \ | ||
| chown osctrl-${COMPONENT}:osctrl-${COMPONENT} -R /opt/osctrl | ||
| COPY osctrl-${COMPONENT}-${GOOS}-${GOARCH}.bin /opt/osctrl/bin/osctrl-${COMPONENT} | ||
| COPY osctrl-${COMPONENT}-${GOOS}-${GOARCH} /opt/osctrl/bin/osctrl-${COMPONENT} |
There was a problem hiding this comment.
This Dockerfile now copies a binary without the .bin suffix, but the repo’s existing GitHub composite action that builds Docker images prepares the context with osctrl-${component}-${GOOS}-${GOARCH}.bin (see .github/actions/build/docker/action.yml:50-52). Unless that workflow has been retired, this change will make those Docker builds fail. Consider keeping compatibility (e.g., make the suffix configurable via a build-arg) or update the CI action(s) in the same PR.
| chown osctrl-${COMPONENT}:osctrl-${COMPONENT} -R /opt/osctrl | ||
|
|
||
| COPY osctrl-${COMPONENT}-${GOOS}-${GOARCH}.bin /opt/osctrl/bin/osctrl-${COMPONENT} | ||
| COPY osctrl-${COMPONENT}-${GOOS}-${GOARCH} /opt/osctrl/bin/osctrl-${COMPONENT} |
There was a problem hiding this comment.
This Dockerfile now copies a binary without the .bin suffix, but the repo’s existing GitHub composite action that builds Docker images prepares the context with osctrl-${component}-${GOOS}-${GOARCH}.bin (see .github/actions/build/docker/action.yml:50-52). Unless that workflow has been retired, this change will make those Docker builds fail. Consider keeping compatibility (e.g., make the suffix configurable via a build-arg) or update the CI action(s) in the same PR.
| use: buildx | ||
| build_flag_templates: | ||
| - "--platform=linux/amd64" | ||
| - "--platform=linux/arm64" | ||
| extra_files: | ||
| - osctrl-tls-linux-amd64 | ||
| - osctrl-tls-linux-arm64 | ||
| - dist/osctrl-tls-linux-amd64 | ||
| - dist/osctrl-tls-linux-arm64 |
There was a problem hiding this comment.
These Docker images are configured to build multi-platform via buildx (--platform=linux/amd64 and --platform=linux/arm64), but the Dockerfiles select the binary using GOOS/GOARCH args (defaulting to linux/amd64). GoReleaser isn’t passing per-platform build args here, so the arm64 image will likely embed the amd64 binary. Prefer using buildx-provided TARGETOS/TARGETARCH in the Dockerfiles (or split into per-arch docker entries) so each platform copies the correct artifact.
| use: buildx | ||
| build_flag_templates: | ||
| - "--platform=linux/amd64" | ||
| - "--platform=linux/arm64" | ||
| extra_files: | ||
| - osctrl-admin-linux-amd64 | ||
| - osctrl-admin-linux-arm64 | ||
| - dist/osctrl-admin-linux-amd64 | ||
| - dist/osctrl-admin-linux-arm64 |
There was a problem hiding this comment.
These Docker images are configured to build multi-platform via buildx (--platform=linux/amd64 and --platform=linux/arm64), but the Dockerfiles select the binary using GOOS/GOARCH args (defaulting to linux/amd64). GoReleaser isn’t passing per-platform build args here, so the arm64 image will likely embed the amd64 binary. Prefer using buildx-provided TARGETOS/TARGETARCH in the Dockerfiles (or split into per-arch docker entries) so each platform copies the correct artifact.
| use: buildx | ||
| build_flag_templates: | ||
| - "--platform=linux/amd64" | ||
| - "--platform=linux/arm64" | ||
| extra_files: | ||
| - osctrl-api-linux-amd64 | ||
| - osctrl-api-linux-arm64 | ||
| - dist/osctrl-api-linux-amd64 | ||
| - dist/osctrl-api-linux-arm64 |
There was a problem hiding this comment.
These Docker images are configured to build multi-platform via buildx (--platform=linux/amd64 and --platform=linux/arm64), but the Dockerfiles select the binary using GOOS/GOARCH args (defaulting to linux/amd64). GoReleaser isn’t passing per-platform build args here, so the arm64 image will likely embed the amd64 binary. Prefer using buildx-provided TARGETOS/TARGETARCH in the Dockerfiles (or split into per-arch docker entries) so each platform copies the correct artifact.
| use: buildx | ||
| build_flag_templates: | ||
| - "--platform=linux/amd64" | ||
| - "--platform=linux/arm64" | ||
| extra_files: | ||
| - osctrl-cli-linux-amd64 | ||
| - osctrl-cli-linux-arm64 | ||
| - dist/osctrl-cli-linux-amd64 | ||
| - dist/osctrl-cli-linux-arm64 |
There was a problem hiding this comment.
These Docker images are configured to build multi-platform via buildx (--platform=linux/amd64 and --platform=linux/arm64), but the Dockerfiles select the binary using GOOS/GOARCH args (defaulting to linux/amd64). GoReleaser isn’t passing per-platform build args here, so the arm64 image will likely embed the amd64 binary. Prefer using buildx-provided TARGETOS/TARGETARCH in the Dockerfiles (or split into per-arch docker entries) so each platform copies the correct artifact.
Fixed Dockerfiles when building using GoReleaser