Skip to content

Conversation

@Electroid
Copy link
Contributor

@Electroid Electroid commented Sep 19, 2023

Closes #5269
Closes #4611
Closes #5454

@Electroid Electroid marked this pull request as draft September 20, 2023 23:06
@Electroid
Copy link
Contributor Author

Need to update GitHub actions, after that will be good to go.

@jumoog
Copy link
Contributor

jumoog commented Sep 22, 2023

You should add --retry-delay ( for example --retry-delay 30 ) to curl. Otherwise, curl will use an exponential backoff algorithm.

When curl is about to retry a transfer, it will first wait one second and then for all forthcoming retries it will double the waiting time until it reaches 10 minutes which then will be the delay between the rest of the retries. Using --retry-delay you can disable this exponential backoff algorithm and set your own delay between the attempts

Source: https://everything.curl.dev/usingcurl/downloads/retry#tweak-your-retries

This means:

request delay in seconds
1 1
2 2
3 4
4 8
5 16

Using the exponential backoff algorithm results in an overall delay of only 31 seconds.

@Electroid Electroid marked this pull request as ready for review September 26, 2023 23:33
@Electroid Electroid merged commit 298515c into main Sep 26, 2023
@Electroid Electroid deleted the improve-docker branch September 26, 2023 23:35
Comment on lines +60 to +65
COPY --from=build /usr/local/bin/bun /usr/local/bin/

# Known issue: `bunx` is not available in distroless.
#
# If `ln` is used in the build image, the size of the final
# image will be double, because of: https://github.com/oven-sh/bun/issues/5269
Copy link
Contributor

@polarathene polarathene Sep 26, 2023

Choose a reason for hiding this comment

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

UPDATE: I opened a PR: #6090


You missed my comment?: #5269 (comment)

You can keep it:

# List of sources to destination (final path):
COPY --from=build \
  /usr/local/bin/bun /usr/local/bin/bunx \
  /usr/local/bin

Comparision:

# Resolved with single COPY, symlink works:
$ docker save local-bun-build | gzip -c | wc -c | numfmt --to iec
40M

# The duplicate issue that previously existed:
$ docker save oven/bun | gzip -c | wc -c | numfmt --to iec
97M

# Resolved vs original image size:
$ docker images
REPOSITORY                  TAG                IMAGE ID       CREATED          SIZE
local-bun-build             latest             020acf83835e   7 minutes ago    110MB
oven/bun                    latest             647ebb4444b7   3 days ago       271MB

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.

Docker image consists of two large identical layers for bun and bunx Add Alpine-based Docker images

5 participants