From 22ffe0d9db46c6d9bc680ee6886c352c8fb5ddcd Mon Sep 17 00:00:00 2001 From: Muhamad Awad Date: Thu, 14 Nov 2024 11:13:41 +0100 Subject: [PATCH] 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 will be made --- .github/workflows/docker.yml | 4 ++-- docker/debug.Dockerfile | 18 ++++++++++++++++++ docker/debug.Dockerfile.dockerignore | 7 +++++++ docker/{Dockerfile => release.Dockerfile} | 0 .../release.Dockerfile.dockerignore | 0 justfile | 7 +++++-- 6 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 docker/debug.Dockerfile create mode 100644 docker/debug.Dockerfile.dockerignore rename docker/{Dockerfile => release.Dockerfile} (100%) rename .dockerignore => docker/release.Dockerfile.dockerignore (100%) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9e0e4b563..67b8305a9 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -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 }} @@ -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 diff --git a/docker/debug.Dockerfile b/docker/debug.Dockerfile new file mode 100644 index 000000000..2255c1f82 --- /dev/null +++ b/docker/debug.Dockerfile @@ -0,0 +1,18 @@ +# 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 archlinux/archlinux AS runtime +RUN pacman -Syu --noconfirm +COPY ./target/debug/restate-server /usr/local/bin/ +WORKDIR / +ENTRYPOINT ["/usr/local/bin/restate-server"] \ No newline at end of file diff --git a/docker/debug.Dockerfile.dockerignore b/docker/debug.Dockerfile.dockerignore new file mode 100644 index 000000000..b42a6458d --- /dev/null +++ b/docker/debug.Dockerfile.dockerignore @@ -0,0 +1,7 @@ +**/.idea +docker/Dockerfile +**/target +target +!target/debug/restate-server +restate.tar +charts diff --git a/docker/Dockerfile b/docker/release.Dockerfile similarity index 100% rename from docker/Dockerfile rename to docker/release.Dockerfile diff --git a/.dockerignore b/docker/release.Dockerfile.dockerignore similarity index 100% rename from .dockerignore rename to docker/release.Dockerfile.dockerignore diff --git a/justfile b/justfile index f65f8d08f..4b2ea9774 100644 --- a/justfile +++ b/justfile @@ -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 @@ -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: build + 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 \n" && cat) > NOTICE