Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worker Docker release build without using cache #2423

Merged
merged 15 commits into from
Jan 30, 2024
10 changes: 6 additions & 4 deletions .github/workflows/create-release-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ jobs:
with:
ref: ${{ env.RELEASE_TAG }}
fetch-depth: 0
- name: Set env
run: |
WORKER_DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | sed 's/.*\(w.*\)/\1/;s/w/v/')
echo "WORKER_DOCKER_TAG=$WORKER_DOCKER_TAG" >> $GITHUB_ENV

- name: Free up disk space
if: startsWith(runner.name, 'GitHub Actions')
Expand All @@ -197,6 +193,11 @@ jobs:
# see https://docs.docker.com/build/drivers/
driver: docker

- name: Set env
run: |
WORKER_DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | sed 's/.*\(w.*\)/\1/;s/w/v/')
echo "WORKER_DOCKER_TAG=$WORKER_DOCKER_TAG" >> $GITHUB_ENV

- name: Build local builder
uses: docker/build-push-action@v5
with:
Expand All @@ -207,6 +208,7 @@ jobs:
build-args: |
WORKER_MODE_ARG=sidechain
ADDITIONAL_FEATURES_ARG=
IMAGE_FOR_RELEASE=true
Kailai-Wang marked this conversation as resolved.
Show resolved Hide resolved

- name: Build worker
uses: docker/build-push-action@v5
Expand Down
18 changes: 13 additions & 5 deletions tee-worker/build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,25 @@ ENV WORKER_MODE=$WORKER_MODE_ARG
ARG ADDITIONAL_FEATURES_ARG
ENV ADDITIONAL_FEATURES=$ADDITIONAL_FEATURES_ARG

ARG IMAGE_FOR_RELEASE=false
ENV IMAGE_FOR_RELEASE=$IMAGE_FOR_RELEASE

ARG FINGERPRINT=none

WORKDIR $HOME/tee-worker
COPY . $HOME

RUN \
rm -rf /opt/rust/registry/cache && mv /home/ubuntu/worker-cache/registry/cache /opt/rust/registry && \
rm -rf /opt/rust/registry/index && mv /home/ubuntu/worker-cache/registry/index /opt/rust/registry && \
rm -rf /opt/rust/git/db && mv /home/ubuntu/worker-cache/git/db /opt/rust/git && \
rm -rf /opt/rust/sccache && mv /home/ubuntu/worker-cache/sccache /opt/rust && \
make && sccache --show-stats
if [ "$IMAGE_FOR_RELEASE" = "true" ]; then \
echo "Omit cache for release image"; \
make; \
else \
rm -rf /opt/rust/registry/cache && mv /home/ubuntu/worker-cache/registry/cache /opt/rust/registry && \
rm -rf /opt/rust/registry/index && mv /home/ubuntu/worker-cache/registry/index /opt/rust/registry && \
rm -rf /opt/rust/git/db && mv /home/ubuntu/worker-cache/git/db /opt/rust/git && \
rm -rf /opt/rust/sccache && mv /home/ubuntu/worker-cache/sccache /opt/rust && \
make && sccache --show-stats; \
fi

RUN cargo test --release

Expand Down