Skip to content

Commit

Permalink
Update Dockerfile to support creating and uploading debuginfos
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkleeman committed Dec 10, 2024
1 parent 346e694 commit 50c7c52
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ on:
required: false
default: false
type: boolean
parca:
description: 'split out debug symbols and upload to polar signals'
required: false
default: false
type: boolean
features:
description: 'features to enable in the build'
required: false
Expand Down Expand Up @@ -46,6 +51,11 @@ on:
required: false
default: false
type: boolean
parca:
description: 'upload debug symbols to polar signals'
required: false
default: false
type: boolean
pushToDockerHub:
description: 'push image to DockerHub'
required: false
Expand All @@ -61,7 +71,7 @@ env:
jobs:
build-and-push-image:
runs-on: warp-ubuntu-latest-x64-16x
timeout-minutes: ${{ inputs.debug && 140 || 70 }}
timeout-minutes: ${{ (inputs.debug || inputs.parca) && 140 || 70 }}

steps:
- name: Checkout repository
Expand Down Expand Up @@ -155,8 +165,11 @@ jobs:
platforms: ${{ github.ref == 'refs/heads/main' && 'linux/arm64,linux/amd64' || (inputs.platforms || 'linux/arm64,linux/amd64') }}
network: host
build-args: |
CARGO_PROFILE_RELEASE_DEBUG=${{ inputs.debug }}
CARGO_PROFILE_RELEASE_DEBUG=${{ inputs.debug || inputs.parca }}
UPLOAD_DEBUGINFO=${{ inputs.parca }}
RESTATE_FEATURES=${{ inputs.features || '' }}
secrets: |
parca=${{ secrets.PARCA_TOKEN }}
cache-from: type=gha,url=http://127.0.0.1:49160/
cache-to: type=gha,url=http://127.0.0.1:49160/,mode=max

Expand Down
21 changes: 16 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0.

ARG UPLOAD_DEBUGINFO=false

FROM --platform=$BUILDPLATFORM ghcr.io/restatedev/dev-tools:latest AS planner
COPY . .
RUN just chef-prepare
Expand Down Expand Up @@ -44,14 +46,23 @@ RUN --mount=type=cache,target=/var/cache/sccache \
just notice-file && \
mv target/$(just arch=$TARGETARCH libc=gnu print-target)/release/restate-server target/restate-server

FROM builder AS upload-false

FROM builder AS upload-true
RUN objcopy --only-keep-debug target/restate-server target/restate-server.debug
RUN objcopy --strip-debug target/restate-server
RUN --mount=type=secret,id=parca parca-debuginfo upload --store-address=grpc.polarsignals.com:443 --bearer-token-file=/run/secrets/parca target/restate-server.debug

FROM upload-$UPLOAD_DEBUGINFO AS upload

# We do not need the Rust toolchain to run the server binary!
FROM debian:bookworm-slim AS runtime
COPY --from=builder /restate/target/restate-server /usr/local/bin
COPY --from=builder /restate/NOTICE /NOTICE
COPY --from=builder /restate/LICENSE /LICENSE
RUN apt-get update && apt-get install --no-install-recommends -y curl && rm -rf /var/lib/apt/lists/*
COPY --from=upload /restate/target/restate-server /usr/local/bin
COPY --from=upload /restate/NOTICE /NOTICE
COPY --from=upload /restate/LICENSE /LICENSE
# copy OS roots
COPY --from=builder /etc/ssl /etc/ssl
COPY --from=upload /etc/ssl /etc/ssl
# useful for health checks
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
WORKDIR /
ENTRYPOINT ["/usr/local/bin/restate-server"]

0 comments on commit 50c7c52

Please sign in to comment.