Skip to content

Commit

Permalink
Debug docker image
Browse files Browse the repository at this point in the history
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
  • Loading branch information
muhamadazmy committed Nov 14, 2024
1 parent 484a0df commit eae9a50
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: "docker/Dockerfile"
file: "docker/release.Dockerfile"
push: ${{ inputs.uploadImageAsTarball != true }}
tags: ${{ steps.meta.outputs.tags }}
load: ${{ inputs.uploadImageAsTarball == true }}
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: "docker/Dockerfile"
file: "docker/release.Dockerfile"
push: true
tags: ${{ steps.meta.outputs.tags }}
load: false
Expand Down
32 changes: 32 additions & 0 deletions docker/debug.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# syntax=docker.io/docker/dockerfile:1.7-labs
# Copyright (c) 2023 - Restate Software, Inc., Restate GmbH.
# All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0.

# This docker file is mainly used to build a local docker image
# with restate binary to run sdk tests

FROM ghcr.io/restatedev/dev-tools:latest AS builder
WORKDIR /usr/src/app
COPY --exclude=.git . .
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

# We do not need the Rust toolchain to run the server binary!
FROM debian:bookworm-slim AS runtime
COPY --from=builder /usr/src/app/restate-server /usr/local/bin
# copy OS roots
COPY --from=builder /etc/ssl /etc/ssl
WORKDIR /
ENTRYPOINT ["/usr/local/bin/restate-server"]
5 changes: 5 additions & 0 deletions docker/debug.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/.idea
docker/Dockerfile
**/target
restate.tar
charts
File renamed without changes.
File renamed without changes.
7 changes: 5 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ docker_repo := "localhost/restatedev/restate"
docker_tag := if path_exists(justfile_directory() / ".git") == "true" {
`git rev-parse --abbrev-ref HEAD | sed 's|/|.|g'` + "." + `git rev-parse --short HEAD`
} else {
"unknown"
"latest"
}
docker_image := docker_repo + ":" + docker_tag

Expand Down Expand Up @@ -135,7 +135,10 @@ verify: lint test doctest
docker:
# podman builds do not work without --platform set, even though it claims to default to host arch
docker buildx build . --platform linux/{{ _docker_arch }} --file docker/Dockerfile --tag={{ docker_image }} --progress='{{ DOCKER_PROGRESS }}' --build-arg RESTATE_FEATURES={{ features }} --load
docker buildx build . --platform linux/{{ _docker_arch }} --file docker/release.Dockerfile --tag={{ docker_image }} --progress='{{ DOCKER_PROGRESS }}' --build-arg RESTATE_FEATURES={{ features }} --load
debug-docker:
docker buildx build . --file docker/debug.Dockerfile --tag={{ docker_image }} --progress='{{ DOCKER_PROGRESS }}' --build-arg RESTATE_FEATURES={{ features }} --load
notice-file:
cargo license -d -a --avoid-build-deps --avoid-dev-deps {{ _features }} | (echo "Restate Runtime\nCopyright (c) 2024 Restate Software, Inc., Restate GmbH <[email protected]>\n" && cat) > NOTICE
Expand Down

0 comments on commit eae9a50

Please sign in to comment.