Skip to content

Commit

Permalink
disable cache for docker builds
Browse files Browse the repository at this point in the history
  • Loading branch information
BuddyGlas committed Nov 26, 2024
1 parent 7a9b109 commit 08d4fce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
12 changes: 2 additions & 10 deletions .docker/Dockerfile-unique
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,10 @@ WORKDIR /workdir
COPY . unique-chain/

ARG FEATURES
# registry for Updating registry. It is safe to cache it, because it only contains references to the dependency files,
# and the caches for the files themselves are set in Cargo.lock, which won't be updated because of --locked flag
# git for Updating git repository. It is safe to cache it, because git dependencies are cached by revision,
# revision is locked in Cargo.lock, and it is forbidden to update the Cargo.lock, because of --locked flag
# passed to cargo build
# target for built dependencies. Technically, it may be unsafe to cache it, but there was no bugs in the caching logic
# of it to this day (Ignoring incremental compilation, which is explicitly disabled by CARGO_INCREMENTAL=0). Only the
# fully built crates will be cached depending on the crate source, version and feature set, which are locked by
# Cargo.lock, which can't be updated because of the --locked flag.

RUN cd unique-chain && \
echo "Using runtime features ${FEATURES}" && \
CARGO_INCREMENTAL=0 cargo build --profile integration-tests --features=fast-inflation,"${FEATURES}" --locked && \
CARGO_INCREMENTAL=0; WASM_BUILD_TYPE=integration-tests; cargo build --profile integration-tests --features=fast-inflation,"${FEATURES}" --locked && \
mv ./target/integration-tests/unique-collator /workdir/unique-chain/ && \
cd target/integration-tests/wbuild && find . -name "*.wasm" -exec sh -c 'mkdir -p "../../../wasm/$(dirname {})"; cp {} "../../../wasm/{}"' \;

Expand Down
2 changes: 1 addition & 1 deletion .docker/Dockerfile-unique-release
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ARG FEATURES

RUN git clone -b "${CODE_VERSION}" https://github.com/uniquenetwork/unique-chain.git && \
cd unique-chain && git switch "${CODE_HASH}" --detach && \
CARGO_INCREMENTAL=0 cargo build --release --features="${FEATURES}" --locked && \
CARGO_INCREMENTAL=0; cargo build --release --features="${FEATURES}" --locked && \
mv ./target/release/unique-collator /workdir/unique-chain/ && \
cd target/release/wbuild && find . -name "*.wasm" -exec sh -c 'mkdir -p "../../../wasm/$(dirname {})"; cp {} "../../../wasm/{}"' \;

Expand Down
4 changes: 2 additions & 2 deletions .github/actions/buildContainer/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ runs:
echo "Available tags:"
echo "$TAGS"
# Check correct version POLKADOT and build it if it doesn't exist in POLKADOT TAGS
# Check correct version and build it if it doesn't exist in TAGS
if [[ ${TAGS[*]} =~ (^|[[:space:]])"${{ inputs.tag }}"($|[[:space:]]) ]]; then
echo "Repository has needed version, pulling";
docker pull ${{ inputs.container }}:${{ inputs.tag }}
else
echo "Repository had no needed version, so build it";
cd "${{ inputs.context }}" && docker build --file "${{ inputs.dockerfile }}" \
cd "${{ inputs.context }}" && docker build --no-cache --file "${{ inputs.dockerfile }}" \
$BUILD_ARGS --tag ${{ inputs.container }}:${{ inputs.tag }} \
.
echo "Push built version to the repository";
Expand Down

0 comments on commit 08d4fce

Please sign in to comment.