-
Notifications
You must be signed in to change notification settings - Fork 44
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
Debug docker image #2294
Debug docker image #2294
Conversation
NOTE: This will work only for linux users and possibly not always duo to difference in libc versions. |
Hey, I worked on something like that before as well, maybe can be useful as reference https://github.com/restatedev/restate/pull/1913/files#diff-c619eafd655a2bbc0adc9b2b704c1f9ae253ccb77ddea1dd3de815ea6a8b9c62R1 Still everything is built within the container, but after the first time this will be super fast to build the next times. |
@slinkydeveloper Thank you for your input. I am wondering why your PR was never merged ? |
@muhamadazmy I never had time to finish it, and i didn't manage the enable the cache in CI, but locally it works fine! So it could be a good fit for |
Summary: While running the sdk-test-suite it was needed to rebuild the restate docker image multiple times which is very time consuming. Now by running `just debug-docker` a quick debug image will be made
@slinkydeveloper Thank you. I reused the docker file from your PR. It's better to also run the build inside a builder stage to avoid issues with libc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for creating the debug Dockerfile @mohammedazmy. I think this is a nice utility for testing things locally.
When I run just debug-docker
, the build fails with:
just debug-docker
docker buildx build . --file docker/debug.Dockerfile --tag=localhost/restatedev/restate:pr2294.eae9a50c --progress='auto' --build-arg RESTATE_FEATURES= --load
[+] Building 5.4s (11/13) docker:orbstack
=> [internal] load build definition from debug.Dockerfile 0.5s
=> => transferring dockerfile: 1.41kB 0.1s
=> resolve image config for docker-image://docker.io/docker/dockerfile:1.7-labs 1.1s
=> CACHED docker-image://docker.io/docker/dockerfile:1.7-labs@sha256:b99fecfe00268a8b556fad7d9c37ee25d716ae08a5d7320e6d51c4dd83246894 0.0s
=> [internal] load metadata for docker.io/library/debian:bookworm-slim 0.7s
=> [internal] load metadata for ghcr.io/restatedev/dev-tools:latest 0.0s
=> [runtime 1/4] FROM docker.io/library/debian:bookworm-slim@sha256:ca3372ce30b03a591ec573ea975ad8b0ecaf0eb17a354416741f8001bbcae33d 0.0s
=> [internal] load build context 0.3s
=> => transferring context: 385.19kB 0.2s
=> [builder 1/4] FROM ghcr.io/restatedev/dev-tools:latest 0.0s
=> CACHED [builder 2/4] WORKDIR /usr/src/app 0.0s
=> CACHED [builder 3/4] COPY --exclude=.git . . 0.0s
=> ERROR [builder 4/4] RUN --mount=type=cache,target=/usr/src/app/target,sharing=locked --mount=type=cache,target=/usr/src/app/cargo-home,sharing=locked du -sh target && du -sh cargo 1.4s
------
> [builder 4/4] RUN --mount=type=cache,target=/usr/src/app/target,sharing=locked --mount=type=cache,target=/usr/src/app/cargo-home,sharing=locked du -sh target && du -sh cargo-home && CARGO_HOME=/usr/src/app/cargo-home just libc=gnu build --bin restate-server && cp target/debug/restate-server restate-server && du -sh target && du -sh cargo-home:
0.939 4.0K target
0.939 0 cargo-home
1.052 cargo build --bin restate-server
1.127 error: process didn't exit successfully: `sccache /usr/local/rustup/toolchains/1.80.1-aarch64-unknown-linux-gnu/bin/rustc -vV` (exit status: 2)
1.127 --- stderr
1.127 sccache: error: Timed out waiting for server startup. Maybe the remote service is unreachable?
1.127 Run with SCCACHE_LOG=debug SCCACHE_NO_DAEMON=1 to get more information
1.127
1.128 error: Recipe `build` failed on line 94 with exit code 101
------
debug.Dockerfile:18
--------------------
17 | COPY --exclude=.git . .
18 | >>> RUN \
19 | >>> --mount=type=cache,target=/usr/src/app/target,sharing=locked \
20 | >>> --mount=type=cache,target=/usr/src/app/cargo-home,sharing=locked \
21 | >>> du -sh target && du -sh cargo-home && \
22 | >>> CARGO_HOME=/usr/src/app/cargo-home just libc=gnu build --bin restate-server && \
23 | >>> cp target/debug/restate-server restate-server && \
24 | >>> du -sh target && du -sh cargo-home
25 |
--------------------
ERROR: failed to solve: process "/bin/sh -c du -sh target && du -sh cargo-home && CARGO_HOME=/usr/src/app/cargo-home just libc=gnu build --bin restate-server && cp target/debug/restate-server restate-server && du -sh target && du -sh cargo-home" did not complete successfully: exit code: 101
I believe the sccache is coming from the dev-tools
base image.
@@ -110,7 +110,7 @@ jobs: | |||
uses: docker/build-push-action@v5 | |||
with: | |||
context: . | |||
file: "docker/Dockerfile" | |||
file: "docker/release.Dockerfile" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a convention to use a capital D
for the Dockerfile
file suffix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It's per their documentation
@@ -0,0 +1,32 @@ | |||
# syntax=docker.io/docker/dockerfile:1.7-labs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I didn't know about this :-)
@@ -0,0 +1,32 @@ | |||
# syntax=docker.io/docker/dockerfile:1.7-labs | |||
# Copyright (c) 2023 - Restate Software, Inc., Restate GmbH. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically this should be 2024.
Hi @slinkydeveloper @muhamadazmy I have managed to enable cache in the CI in #2232 |
Hi @aradwann. I already reviewed your PR. Thank you so much, it looks really good 😊. This PR here on the other hand is meant for local development and not CI. |
Debug docker image
Summary:
While running the sdk-test-suite it was needed to rebuild
the restate docker image multiple times which is very time
consuming.
Now by running
just debug-docker
a quick debug image willbe made (at least on second time)