-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from AkihiroSuda/dev
entrypoint.js: fix script path
- Loading branch information
Showing
3 changed files
with
27 additions
and
19 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
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 |
---|---|---|
@@ -1,20 +1,24 @@ | ||
#!/bin/bash | ||
set -eux -o pipefail | ||
: "Argv0: $0" | ||
dir="$(dirname "$0")" | ||
read_action_input() { | ||
"${dir}/read-action-input" "$1" | ||
} | ||
: "Clean Directories" | ||
rm -Rf "$(./read-action-input scratch-dir)" && mkdir -p "$(./read-action-input scratch-dir)" "$(./read-action-input cache-source)" | ||
rm -Rf "$(read_action_input scratch-dir)" && mkdir -p "$(read_action_input scratch-dir)" "$(read_action_input cache-source)" | ||
: "Prepare Timestamp for Layer Cache Busting" | ||
date --iso=ns | tee "$(./read-action-input cache-source)"/buildstamp | ||
date --iso=ns | tee "$(read_action_input cache-source)"/buildstamp | ||
: "Prepare Dancefile to Access Caches" | ||
cat >"$(./read-action-input scratch-dir)"/Dancefile.inject <<EOF | ||
cat >"$(read_action_input scratch-dir)"/Dancefile.inject <<EOF | ||
FROM busybox:1 | ||
COPY buildstamp buildstamp | ||
RUN --mount=type=cache,target="$(./read-action-input cache-target)" \ | ||
RUN --mount=type=cache,target="$(read_action_input cache-target)" \ | ||
--mount=type=bind,source=.,target=/var/dance-cache \ | ||
cp -p -R /var/dance-cache/. "$(./read-action-input cache-target)" || true | ||
cp -p -R /var/dance-cache/. "$(read_action_input cache-target)" || true | ||
EOF | ||
cat "$(./read-action-input scratch-dir)"/Dancefile.inject | ||
cat "$(read_action_input scratch-dir)"/Dancefile.inject | ||
: "Inject Data into Docker Cache" | ||
docker buildx build -f "$(./read-action-input scratch-dir)"/Dancefile.inject --tag dance:inject "$(./read-action-input cache-source)" | ||
docker buildx build -f "$(read_action_input scratch-dir)"/Dancefile.inject --tag dance:inject "$(read_action_input cache-source)" | ||
: "Clean Directories" | ||
sudo rm -rf "$(./read-action-input cache-source)" | ||
sudo rm -rf "$(read_action_input cache-source)" |
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 |
---|---|---|
@@ -1,23 +1,27 @@ | ||
#!/bin/bash | ||
set -eux -o pipefail | ||
: "Argv0: $0" | ||
dir="$(dirname "$0")" | ||
read_action_input() { | ||
"${dir}/read-action-input" "$1" | ||
} | ||
: "Prepare Timestamp for Layer Cache Busting" | ||
date --iso=ns | tee "$(./read-action-input scratch-dir)"/buildstamp | ||
date --iso=ns | tee "$(read_action_input scratch-dir)"/buildstamp | ||
: "Prepare Dancefile to Access Caches" | ||
cat >"$(./read-action-input scratch-dir)"/Dancefile.extract <<EOF | ||
cat >"$(read_action_input scratch-dir)"/Dancefile.extract <<EOF | ||
FROM busybox:1 | ||
COPY buildstamp buildstamp | ||
RUN --mount=type=cache,target="$(./read-action-input cache-target)" \ | ||
RUN --mount=type=cache,target="$(read_action_input cache-target)" \ | ||
mkdir -p /var/dance-cache/ \ | ||
&& cp -p -R "$(./read-action-input cache-target)"/. /var/dance-cache/ || true | ||
&& cp -p -R "$(read_action_input cache-target)"/. /var/dance-cache/ || true | ||
EOF | ||
cat "$(./read-action-input scratch-dir)"/Dancefile.extract | ||
cat "$(read_action_input scratch-dir)"/Dancefile.extract | ||
: "Extract Data into Docker Image" | ||
docker buildx build -f "$(./read-action-input scratch-dir)"/Dancefile.extract --tag dance:extract --load "$(./read-action-input scratch-dir)" | ||
docker buildx build -f "$(read_action_input scratch-dir)"/Dancefile.extract --tag dance:extract --load "$(read_action_input scratch-dir)" | ||
: "Create Extraction Image" | ||
docker rm -f cache-container && docker create -ti --name cache-container dance:extract | ||
: "Unpack Docker Image into Scratch" | ||
docker cp -L cache-container:/var/dance-cache - | tar -H posix -x -C "$(./read-action-input scratch-dir)" | ||
docker cp -L cache-container:/var/dance-cache - | tar -H posix -x -C "$(read_action_input scratch-dir)" | ||
: "Move Cache into Its Place" | ||
sudo rm -rf "$(./read-action-input cache-source)" | ||
mv "$(./read-action-input scratch-dir)"/dance-cache "$(./read-action-input cache-source)" | ||
sudo rm -rf "$(read_action_input cache-source)" | ||
mv "$(read_action_input scratch-dir)"/dance-cache "$(read_action_input cache-source)" |