Skip to content

Commit

Permalink
Worker Docker release build without using cache (#2423)
Browse files Browse the repository at this point in the history
* omit using cache for docker build
  • Loading branch information
Traf333 committed Jan 30, 2024
1 parent 28167f6 commit 3571560
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
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
- 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

0 comments on commit 3571560

Please sign in to comment.