fix images & add runtime image version

This commit is contained in:
hosted-fornet 2024-09-27 19:05:34 -07:00
parent 5061ea860e
commit 088ce6c4d8
6 changed files with 17 additions and 14 deletions

View File

@ -15,6 +15,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libclang-dev \ libclang-dev \
clang \ clang \
curl \ curl \
git \
python3 \
&& update-ca-certificates \ && update-ca-certificates \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*

View File

@ -3,12 +3,6 @@ FROM nick1udwig/buildbase:latest
ENV NVM_DIR=/root/.nvm \ ENV NVM_DIR=/root/.nvm \
PATH="/root/.nvm/versions/node/$(node -v)/bin:${PATH}" PATH="/root/.nvm/versions/node/$(node -v)/bin:${PATH}"
# Install Git
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
python3 \
&& rm -rf /var/lib/apt/lists/*
RUN . ~/.bashrc \ RUN . ~/.bashrc \
&& . ~/.cargo/env \ && . ~/.cargo/env \
&& . $NVM_DIR/nvm.sh \ && . $NVM_DIR/nvm.sh \

View File

@ -1,16 +1,14 @@
FROM nick1udwig/buildbase:latest FROM nick1udwig/buildbase:latest
ENV NVM_DIR=/root/.nvm \ ARG DOCKER_BUILD_IMAGE_VERSION=latest
PATH="/root/.nvm/versions/node/$(node -v)/bin:${PATH}"
RUN apt-get update && apt-get install -y --no-install-recommends \ ENV NVM_DIR=/root/.nvm \
git \ PATH="/root/.nvm/versions/node/$(node -v)/bin:${PATH}" \
python3 \ DOCKER_BUILD_IMAGE_VERSION=$DOCKER_BUILD_IMAGE_VERSION
&& rm -rf /var/lib/apt/lists/*
# Bind readonly & copy files in to avoid modifying host files # Bind readonly & copy files in to avoid modifying host files
WORKDIR /input WORKDIR /input
# Set the default command to run the build script # Set the default command to run the build script
# TODO: once build is idempotent, remove the `rm -rf` line # TODO: once build is idempotent, remove the `rm -rf` line
CMD ["/bin/bash", "-c", ". ~/.bashrc && . ~/.cargo/env && . $NVM_DIR/nvm.sh && rm -rf target/ kinode/packages/*/pkg/*wasm kinode/packages/*/*/target/ kinode/packages/*/pkg/api.zip kinode/packages/*/*/wit && ./scripts/build-release.py && cp -r /tmp/kinode-release/* /output && chmod 664 /output/* && rm -rf target/ kinode/packages/*/pkg/*wasm kinode/packages/*/*/target/ kinode/packages/*/pkg/api.zip kinode/packages/*/*/wit"] CMD ["/bin/bash", "-c", ". ~/.bashrc && . ~/.cargo/env && . $NVM_DIR/nvm.sh && rm -rf target/ kinode/packages/*/pkg/*wasm kinode/packages/*/*/target/ kinode/packages/*/pkg/api.zip kinode/packages/*/*/wit kinode/packages/app_store/pkg/ui kinode/packages/homepage/pkg/ui kinode/src/register-ui/build && ./scripts/build-release.py && cp -r /tmp/kinode-release/* /output && chmod 664 /output/* && rm -rf target/ kinode/packages/*/pkg/*wasm kinode/packages/*/*/target/ kinode/packages/*/pkg/api.zip kinode/packages/*/*/wit kinode/packages/app_store/pkg/ui kinode/packages/homepage/pkg/ui kinode/src/register-ui/build"]

View File

@ -222,5 +222,13 @@ fn main() -> anyhow::Result<()> {
let bootstrapped_processes_path = target_dir.join("bootstrapped_processes.rs"); let bootstrapped_processes_path = target_dir.join("bootstrapped_processes.rs");
fs::write(&bootstrapped_processes_path, bootstrapped_processes)?; fs::write(&bootstrapped_processes_path, bootstrapped_processes)?;
let version = if let Ok(version) = std::env::var("DOCKER_BUILD_IMAGE_VERSION") {
// embed the DOCKER_BUILD_IMAGE_VERSION
version
} else {
"none".to_string()
};
println!("cargo:rustc-env=DOCKER_BUILD_IMAGE_VERSION={version}");
Ok(()) Ok(())
} }

View File

@ -60,6 +60,7 @@ pub const MULTICALL_ADDRESS: &str = "0xcA11bde05977b3631167028862bE2a173976CA11"
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
println!("\nDOCKER_BUILD_IMAGE_VERSION: {}\n", env!("DOCKER_BUILD_IMAGE_VERSION"));
let app = build_command(); let app = build_command();
let matches = app.get_matches(); let matches = app.get_matches();

View File

@ -42,7 +42,7 @@ def build_and_move(feature, tmp_dir, architecture, os_name):
source_path = f"target/release/{binary_name}" source_path = f"target/release/{binary_name}"
dest_path = os.path.join(tmp_dir, binary_name) dest_path = os.path.join(tmp_dir, binary_name)
shutil.move(source_path, dest_path) shutil.move(source_path, dest_path)
os.chmod(dest_path, 0o664) os.chmod(dest_path, 0o775)
# Create a zip archive of the binary # Create a zip archive of the binary
zip_path = os.path.join(tmp_dir, zip_name) zip_path = os.path.join(tmp_dir, zip_name)