Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update the Golang Dockerfilegenerator transformer to support multi-arch build #943

Merged
merged 2 commits into from
Jan 15, 2023

Conversation

Akash-Nayak
Copy link
Contributor

@Akash-Nayak Akash-Nayak commented Jan 9, 2023

Changed the base image to registry.access.redhat.com/ubi8/go-toolset for building the app with multi-arch support. The base image supports amd64/arm64/ppc64le/s390x.

I was successfully able to build the multi-arch image for amd64, arm64 and ppc64le (Power), but for s390x (Z) arch the build gets stuck at RUN go build -o ./bin/golang.

golang-s390x-build-stuck

scripts git:(main) ✗ ./buildandpushimages_multiarch.sh quay.io akashnayak linux/amd64,linux/arm64,linux/ppc64le
building and pushing image golang
[+] Building 60.7s (29/29) FINISHED                                                                     
 => [internal] load .dockerignore                                                                  0.0s
 => => transferring context: 2B                                                                    0.0s
 => [internal] load build definition from Dockerfile                                               0.0s
 => => transferring dockerfile: 919B                                                               0.0s
 => [linux/arm64 internal] load metadata for registry.access.redhat.com/ubi8/ubi-minimal:8.3-201   2.7s
 => [linux/ppc64le internal] load metadata for registry.access.redhat.com/ubi8/ubi-minimal:8.3-20  2.8s
 => [linux/ppc64le internal] load metadata for registry.access.redhat.com/ubi8/go-toolset:1.16.12  2.6s
 => [linux/arm64 internal] load metadata for registry.access.redhat.com/ubi8/go-toolset:1.16.12    3.1s
 => [linux/amd64 internal] load metadata for registry.access.redhat.com/ubi8/go-toolset:1.16.12    3.2s
 => [linux/amd64 internal] load metadata for registry.access.redhat.com/ubi8/ubi-minimal:8.3-201   3.2s
 => [linux/arm64 builder 1/4] FROM registry.access.redhat.com/ubi8/go-toolset:1.16.12@sha256:02f3  0.0s
 => => resolve registry.access.redhat.com/ubi8/go-toolset:1.16.12@sha256:02f3a14a5da5d31d84ff7024  0.0s
 => [linux/ppc64le builder 1/4] FROM registry.access.redhat.com/ubi8/go-toolset:1.16.12@sha256:02  0.1s
 => => resolve registry.access.redhat.com/ubi8/go-toolset:1.16.12@sha256:02f3a14a5da5d31d84ff7024  0.1s
 => [linux/arm64 stage-1 1/2] FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3-201@sha256:c64  0.0s
 => => resolve registry.access.redhat.com/ubi8/ubi-minimal:8.3-201@sha256:c6473956faa4985a4177670  0.1s
 => => sha256:4ee348554246a67f2ff154f1d013791537c91be2622b1629c1c090a9062ee1d0 38.92MB / 38.92MB   3.7s
 => => extracting sha256:4ee348554246a67f2ff154f1d013791537c91be2622b1629c1c090a9062ee1d0          2.1s
 => => extracting sha256:74f4d11444244c906adeed562ee9b79a53d9b70dddd69aff036d91bfb1046a7a          0.0s
 => [linux/ppc64le stage-1 1/2] FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3-201@sha256:c  0.1s
 => => resolve registry.access.redhat.com/ubi8/ubi-minimal:8.3-201@sha256:c6473956faa4985a4177670  0.1s
 => [linux/amd64 builder 1/4] FROM registry.access.redhat.com/ubi8/go-toolset:1.16.12@sha256:02f3  5.2s
 => => resolve registry.access.redhat.com/ubi8/go-toolset:1.16.12@sha256:02f3a14a5da5d31d84ff7024  0.1s
 => => sha256:bc0678604f4ccd27f1d623736cfa7b978f2b8807215c16c7545cff150137d3 144.10MB / 144.10MB  13.1s
 => => sha256:7b8efddf55ed035efb83c57cf21362b76d1cffb2c88864f11de91ee823c86a 143.01MB / 143.01MB  26.0s
 => => extracting sha256:7b8efddf55ed035efb83c57cf21362b76d1cffb2c88864f11de91ee823c86afa          6.2s
 => => extracting sha256:bc0678604f4ccd27f1d623736cfa7b978f2b8807215c16c7545cff150137d332          5.2s
 => [internal] load build context                                                                  0.0s
 => => transferring context: 84B                                                                   0.0s
 => [linux/amd64 stage-1 1/2] FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3-201@sha256:c64  0.0s
 => => resolve registry.access.redhat.com/ubi8/ubi-minimal:8.3-201@sha256:c6473956faa4985a4177670  0.1s
 => => sha256:c0194df27effde85019e70c3b7a3f2571c3aabe30f5b0c96c86ed528a0ca06c1 1.73kB / 1.73kB     1.2s
 => => sha256:4753a4528f5f857083f7c31ba761a3ed67c0005660cc488d96b1b80165946a38 39.38MB / 39.38MB   8.2s
 => => extracting sha256:4753a4528f5f857083f7c31ba761a3ed67c0005660cc488d96b1b80165946a38          1.7s
 => => extracting sha256:c0194df27effde85019e70c3b7a3f2571c3aabe30f5b0c96c86ed528a0ca06c1          0.0s
 => CACHED [linux/arm64 builder 2/4] WORKDIR /golang                                               0.0s
 => CACHED [linux/arm64 builder 3/4] COPY . .                                                      0.0s
 => CACHED [linux/arm64 builder 4/4] RUN go build -o ./bin/golang                                  0.0s
 => CACHED [linux/ppc64le builder 2/4] WORKDIR /golang                                             0.0s
 => CACHED [linux/ppc64le builder 3/4] COPY . .                                                    0.0s
 => CACHED [linux/ppc64le builder 4/4] RUN go build -o ./bin/golang                                0.0s
 => CACHED [linux/ppc64le stage-1 2/2] COPY --from=builder /golang/bin/golang /bin/golang          0.0s
 => [linux/arm64 stage-1 2/2] COPY --from=builder /golang/bin/golang /bin/golang                   0.3s
 => [linux/amd64 builder 2/4] WORKDIR /golang                                                      0.6s
 => [linux/amd64 builder 3/4] COPY . .                                                             0.0s
 => [linux/amd64 builder 4/4] RUN go build -o ./bin/golang                                         0.8s
 => [linux/amd64 stage-1 2/2] COPY --from=builder /golang/bin/golang /bin/golang                   0.1s
 => exporting to image                                                                            17.0s
 => => exporting layers                                                                            0.4s
 => => exporting manifest sha256:9e99b280ff366804d4ce10b1625f06ff20fa61cbbb7347fd8f74ec1d1b45ed50  0.0s
 => => exporting config sha256:709b008f5a9122c063486387a627c52adfd7b64fd87fb64e481fa97dbaad9fc6    0.0s
 => => exporting manifest sha256:782a848462fad9b05b52de0dea2791a102d2c9d0bd3532740775a4683c4361a0  0.0s
 => => exporting config sha256:29b60a01023ca6a59662d59921bff566ea1d178f347afefea99148c7e5daaaa6    0.0s
 => => exporting manifest sha256:8bf67a4bc314b945052440e3533116f2791a3606ed9af81afdeee1931bb253c5  0.0s
 => => exporting config sha256:3e09a4620c2b3d54f681671e101823e82eca0ec4925c92eefa4001f333735369    0.0s
 => => exporting manifest list sha256:cbb73dbf139704adcf7d8bed60ff2613cf0e162b463ac481401e6c88987  0.0s
 => => pushing layers                                                                             11.5s
 => => pushing manifest for quay.io/akashnayak/golang:latest@sha256:cbb73dbf139704adcf7d8bed60ff2  5.0s
 => [auth] akashnayak/golang:pull,push token for quay.io                                           0.0s
/Users/akash/github/move2kube-demos/samples/language-platforms/myproject
done

Screenshot 2023-01-09 at 8 07 06 PM

Also, tested the deployment on OpenShift cluster with the multi-arch image.

Screenshot 2023-01-09 at 7 57 44 PM

Signed-off-by: Akash Nayak akash19nayak@gmail.com

…lti-arch build

Signed-off-by: Akash Nayak <akash19nayak@gmail.com>
@github-actions
Copy link

github-actions bot commented Jan 9, 2023

Thanks for making a pull request! 😃
One of the maintainers will review and advise on the next steps.

@github-actions github-actions bot added the feat label Jan 9, 2023
@codecov
Copy link

codecov bot commented Jan 9, 2023

Codecov Report

Base: 15.24% // Head: 15.27% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (8c95e18) compared to base (1cb2304).
Patch has no changes to coverable lines.

❗ Current head 8c95e18 differs from pull request most recent head 24e630c. Consider uploading reports for the commit 24e630c to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #943      +/-   ##
==========================================
+ Coverage   15.24%   15.27%   +0.02%     
==========================================
  Files          50       50              
  Lines        4611     4603       -8     
==========================================
  Hits          703      703              
+ Misses       3732     3724       -8     
  Partials      176      176              
Impacted Files Coverage Δ
qaengine/httprestengine.go 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@ashokponkumar ashokponkumar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work Akash! Well implemented.

@ashokponkumar ashokponkumar enabled auto-merge (squash) January 15, 2023 04:06
@ashokponkumar ashokponkumar merged commit e86cbfe into konveyor:main Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants