Skip to content

Dockerfile, additional scripts and minor improvements #20

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

drodbar
Copy link

@drodbar drodbar commented Mar 11, 2025

Upgrade amqp091-go module to v0.10.0 and Go to version to 1.24.
Modify main.go to return usage message when no queue is provided.
Update CHANGELOG.md and README.md
Add Dockerfile and .dockerignore
Add scripts to build_container, test and wait-for-it.sh

Modify main.go to return help when no queue is provided
Update README.md, and CHANGELOG.md
Add Dockerfile and .dockerignore
Add scripts build_container, test and wait-for-it.sh
@dubek
Copy link
Owner

dubek commented Mar 13, 2025

Thank you @drodbar ! I'm away, I'll look at it sometime next week when I'm back.

@drodbar
Copy link
Author

drodbar commented Mar 13, 2025

thanks @dubek! I just pushed another minor change to avoid breaking CICD changes within github, after I had changed the binary's path for convenience.

Dockerfile Outdated
RUN apk add --no-cache git
RUN adduser -u ${UID} -D -h /app -H scratchuser

RUN CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' -o rabbitmq-dump-queue .
Copy link
Owner

Choose a reason for hiding this comment

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

curious: why is -ldflags '-extldflags "-static"' needed? I thought that Go produces static binaries by default.

Copy link
Author

Choose a reason for hiding this comment

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

This guarantees that external libraries are statically linked.

Copy link
Owner

Choose a reason for hiding this comment

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

I tried building without this switch and I still get a static executable binary:

root@b25b978e723c:/src# CGO_ENABLED=0 go build -o rabbitmq-dump-queue .

root@b25b978e723c:/src# file rabbitmq-dump-queue
rabbitmq-dump-queue: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=fhhU8b2aXc28kCT16E8a/4QcClZJmZ-5y4WiCGkBh/NZLLOP-9hG60fNzI2C3U/Dimpzw275iXwL7wku7Pb, with debug_info, not stripped

root@b25b978e723c:/src# ldd rabbitmq-dump-queue
	not a dynamic executable

Copy link
Author

Choose a reason for hiding this comment

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

You are totally right, we don't need it here.

Copy link
Owner

@dubek dubek left a comment

Choose a reason for hiding this comment

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

Thanks @drodbar for addressing my previous remarks. A few more comments below.

@drodbar drodbar force-pushed the main branch 7 times, most recently from ea14c1c to a807f18 Compare March 24, 2025 11:25
@drodbar
Copy link
Author

drodbar commented Mar 27, 2025

Hi @dubek, did you have a chance to look at the changes? I think there is nothing else to address in my end at the moment. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants