forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move: source service docker file (MystenLabs#13082)
## Description As in title. ## Test Plan How did you test the new or updated feature? Built the image with docker, N/A --- If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes
- Loading branch information
1 parent
65c820a
commit 8e67b9c
Showing
2 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
FROM rust:1.70.0 AS chef | ||
WORKDIR sui | ||
ARG GIT_REVISION | ||
ENV GIT_REVISION=$GIT_REVISION | ||
RUN apt-get update && apt-get install -y cmake clang | ||
|
||
# Plan out the 3rd-party dependencies that need to be built. | ||
# | ||
# This is done by: | ||
# 1. Copy in Cargo.toml, Cargo.lock, and the workspace-hack crate | ||
# 2. Removing all workspace crates, other than the workpsace-hack | ||
# crate, from the workspace Cargo.toml file. | ||
# 3. Update the lockfile in order to reflect the changes to the | ||
# root Cargo.toml file. | ||
# FROM chef AS planner | ||
# COPY Cargo.toml Cargo.lock ./ | ||
# COPY crates/workspace-hack crates/workspace-hack | ||
# RUN sed -i '/crates\/workspace-hack/b; /crates/d; /narwhal/d' Cargo.toml \ | ||
# && cargo metadata -q >/dev/null | ||
|
||
# Build and cache all dependencies. | ||
# | ||
# In a fresh layer, copy in the "plan" generated by the planner | ||
# and run `cargo build` in order to create a caching Docker layer | ||
# with all dependencies built. | ||
FROM chef AS builder | ||
# COPY --from=planner /sui/Cargo.toml Cargo.toml | ||
# COPY --from=planner /sui/Cargo.lock Cargo.lock | ||
# COPY --from=planner /sui/crates/workspace-hack crates/workspace-hack | ||
# RUN cargo build --release | ||
|
||
# Build application | ||
# | ||
# Copy in the rest of the crates (and an unmodified Cargo.toml and Cargo.lock) | ||
# and build the application. At this point no dependencies should need to be | ||
# built as they were built and cached by the previous layer. | ||
COPY Cargo.toml Cargo.lock ./ | ||
COPY crates crates | ||
COPY sui-execution sui-execution | ||
COPY narwhal narwhal | ||
COPY external-crates external-crates | ||
RUN cargo build --release \ | ||
--bin sui-source-validation-service | ||
|
||
# Production Image | ||
FROM debian:bullseye-slim AS runtime | ||
WORKDIR sui | ||
COPY --from=builder /sui/target/release/sui-source-validation-service /usr/local/bin | ||
|
||
ARG BUILD_DATE | ||
ARG GIT_REVISION | ||
LABEL build-date=$BUILD_DATE | ||
LABEL git-revision=$GIT_REVISION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
# Copyright (c) Mysten Labs, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# fast fail. | ||
set -e | ||
|
||
DIR="$( cd "$( dirname "$0" )" && pwd )" | ||
REPO_ROOT="$(git rev-parse --show-toplevel)" | ||
DOCKERFILE="$DIR/Dockerfile" | ||
GIT_REVISION="$(git describe --always --dirty --exclude '*')" | ||
BUILD_DATE="$(date -u +'%Y-%m-%d')" | ||
|
||
echo | ||
echo "Building sui-source-service docker image" | ||
echo "Dockerfile: \t$DOCKERFILE" | ||
echo "docker context: $REPO_ROOT" | ||
echo "build date: \t$BUILD_DATE" | ||
echo "git revision: \t$GIT_REVISION" | ||
echo | ||
|
||
docker build -f "$DOCKERFILE" "$REPO_ROOT" \ | ||
--build-arg GIT_REVISION="$GIT_REVISION" \ | ||
--build-arg BUILD_DATE="$BUILD_DATE" \ | ||
"$@" |