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 \
clang \
curl \
git \
python3 \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/*

View File

@ -3,12 +3,6 @@ FROM nick1udwig/buildbase:latest
ENV NVM_DIR=/root/.nvm \
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 \
&& . ~/.cargo/env \
&& . $NVM_DIR/nvm.sh \

View File

@ -1,16 +1,14 @@
FROM nick1udwig/buildbase:latest
ENV NVM_DIR=/root/.nvm \
PATH="/root/.nvm/versions/node/$(node -v)/bin:${PATH}"
ARG DOCKER_BUILD_IMAGE_VERSION=latest
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
python3 \
&& rm -rf /var/lib/apt/lists/*
ENV NVM_DIR=/root/.nvm \
PATH="/root/.nvm/versions/node/$(node -v)/bin:${PATH}" \
DOCKER_BUILD_IMAGE_VERSION=$DOCKER_BUILD_IMAGE_VERSION
# Bind readonly & copy files in to avoid modifying host files
WORKDIR /input
# Set the default command to run the build script
# 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");
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(())
}

View File

@ -60,6 +60,7 @@ pub const MULTICALL_ADDRESS: &str = "0xcA11bde05977b3631167028862bE2a173976CA11"
#[tokio::main]
async fn main() {
println!("\nDOCKER_BUILD_IMAGE_VERSION: {}\n", env!("DOCKER_BUILD_IMAGE_VERSION"));
let app = build_command();
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}"
dest_path = os.path.join(tmp_dir, binary_name)
shutil.move(source_path, dest_path)
os.chmod(dest_path, 0o664)
os.chmod(dest_path, 0o775)
# Create a zip archive of the binary
zip_path = os.path.join(tmp_dir, zip_name)