Skip to content

Commit

Permalink
Add restatectl and restate to the docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
muhamadazmy committed Jan 20, 2025
1 parent 0a19ec8 commit 0ac0d58
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,17 @@ ENV SCCACHE_DIR=/var/cache/sccache
# Should be set to 'false' or 'true'. See https://doc.rust-lang.org/cargo/reference/environment-variables.html
ARG CARGO_PROFILE_RELEASE_DEBUG=false
ARG RESTATE_FEATURES=''
RUN just arch=$TARGETARCH libc=gnu features=$RESTATE_FEATURES chef-cook --release --bin restate-server
RUN just arch=$TARGETARCH libc=gnu features=$RESTATE_FEATURES chef-cook --release --bins
COPY . .
# Mount the sccache directory as a cache to leverage sccache during build
# Caching layer if nothing has changed
# Use sccache during the main build
RUN --mount=type=cache,target=/var/cache/sccache \
just arch=$TARGETARCH libc=gnu features=$RESTATE_FEATURES build --release --bin restate-server && \
just arch=$TARGETARCH libc=gnu features=$RESTATE_FEATURES build --release --bins && \
just notice-file && \
mv target/$(just arch=$TARGETARCH libc=gnu print-target)/release/restate-server target/restate-server
mv target/$(just arch=$TARGETARCH libc=gnu print-target)/release/restate-server target/restate-server && \
mv target/$(just arch=$TARGETARCH libc=gnu print-target)/release/restatectl target/restatectl && \
mv target/$(just arch=$TARGETARCH libc=gnu print-target)/release/restate target/restate

FROM builder AS upload-false

Expand All @@ -64,5 +66,7 @@ COPY --from=builder /restate/LICENSE /LICENSE
# copy OS roots
COPY --from=builder /etc/ssl /etc/ssl
COPY --from=upload /restate/target/restate-server /usr/local/bin
COPY --from=upload /restate/target/restatectl /usr/local/bin
COPY --from=upload /restate/target/restate /usr/local/bin
WORKDIR /
ENTRYPOINT ["/usr/local/bin/restate-server"]
10 changes: 7 additions & 3 deletions docker/debug.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,23 @@ ENV SCCACHE_DIR=/var/cache/sccache
# Should be set to 'false' or 'true'. See https://doc.rust-lang.org/cargo/reference/environment-variables.html
ARG CARGO_PROFILE_RELEASE_DEBUG=false
ARG RESTATE_FEATURES=''
RUN just arch=$TARGETARCH libc=gnu features=$RESTATE_FEATURES chef-cook --bin restate-server
RUN just arch=$TARGETARCH libc=gnu features=$RESTATE_FEATURES chef-cook --bins
COPY . .
# Mount the sccache directory as a cache to leverage sccache during build
# Caching layer if nothing has changed
# Use sccache during the main build
RUN --mount=type=cache,target=/var/cache/sccache \
just arch=$TARGETARCH libc=gnu features=$RESTATE_FEATURES build --bin restate-server && \
just arch=$TARGETARCH libc=gnu features=$RESTATE_FEATURES build --bins && \
just notice-file && \
mv target/$(just arch=$TARGETARCH libc=gnu print-target)/debug/restate-server target/restate-server
mv target/$(just arch=$TARGETARCH libc=gnu print-target)/debug/restate-server target/restate-server && \
mv target/$(just arch=$TARGETARCH libc=gnu print-target)/debug/restatectl target/restatectl && \
mv target/$(just arch=$TARGETARCH libc=gnu print-target)/debug/restate target/restate

# 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/target/restatectl /usr/local/bin
COPY --from=builder /restate/target/restate /usr/local/bin
COPY --from=builder /restate/NOTICE /NOTICE
COPY --from=builder /restate/LICENSE /LICENSE
# copy OS roots
Expand Down

0 comments on commit 0ac0d58

Please sign in to comment.