8000 cachebust-apps · sabrehagen/desktop-environment@848edd5 · GitHub
[go: up one dir, main page]

Skip to content

Commit

Permalink
cachebust-apps
Browse files Browse the repository at this point in the history
  • Loading branch information
decidrjackson committed Mar 4, 2025
1 parent 1cb5219 commit 848edd5
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-from-dotfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
uses: docker/build-push-action@v4
with:
build-args: |
CACHEBUST_DOTFILES=${{ github.sha }}
DESKTOP_ENVIRONMENT_USER=${{ env.REPOSITORY_OWNER }}
DESKTOP_ENVIRONMENT_GITHUB_USER=${{ env.REPOSITORY_OWNER }}
DOTFILES_CACHEBUST=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
file: docker/Dockerfile
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.build-exit-code
.build-exit-time
.dotfiles-cachebust
.cachebust-apps
.cachebust-dotfiles
10 changes: 7 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ RUN apt-get update -qq && \
zsh && \
apt-file update

# If the CACHEBUST_APPS build arg is supplied, rebuild from apps onwards
ARG CACHEBUST_APPS
RUN echo 'Building from apps onwards...'

# Install rust
RUN apt-get update -qq && \
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly --no-modify-path --profile minimal && \
Expand Down Expand Up @@ -581,9 +585,9 @@ WORKDIR $HOME
# Clone the desktop environment
RUN git clone https://github.com/sabrehagen/desktop-environment /opt/desktop-environment

# If the DOTFILES_CACHEBUST build arg is supplied, rebuild from static dotfiles onwards
ARG DOTFILES_CACHEBUST
RUN DOTFILES_CACHEBUST=$DOTFILES_CACHEBUST echo 'Building from dotfiles...'
# If the CACHEBUST_DOTFILES build arg is supplied, rebuild from static dotfiles onwards
ARG CACHEBUST_DOTFILES
RUN echo 'Building from dotfiles...'

# Clone user dotfiles or fallback to sabrehagen dotfiles
RUN vcsh clone https://github.com/sabrehagen/dotfiles
Expand Down
10 changes: 10 additions & 0 deletions docker/scripts/build-apps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
REPO_ROOT=$(dirname $(readlink -f $0))/../..

# Export desktop environment shell configuration
eval "$($REPO_ROOT/docker/scripts/environment.sh)"

# Set the cachebust file to rebuild from apps onwards
CACHEBUST_APPS=$(date +%s > $REPO_ROOT/.cachebust-apps)

# Rebuild the desktop environment
$REPO_ROOT/docker/scripts/build.sh
2 changes: 1 addition & 1 deletion docker/scripts/build-dotfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ REPO_ROOT=$(dirname $(readlink -f $0))/../..
eval "$($REPO_ROOT/docker/scripts/environment.sh)"

# Set the cachebust file to rebuild from dotfiles onwards
DOTFILES_CACHEBUST=$(date +%s > $REPO_ROOT/.dotfiles-cachebust)
CACHEBUST_DOTFILES=$(date +%s > $REPO_ROOT/.cachebust-dotfiles)

# Rebuild the desktop environment
$REPO_ROOT/docker/scripts/build.sh
3 changes: 2 additions & 1 deletion docker/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ eval "$($REPO_ROOT/docker/scripts/environment.sh)"
DESKTOP_ENVIRONMENT_HOST_USER_PASSWORD=$(sudo cat /etc/shadow | grep $DESKTOP_ENVIRONMENT_USER | cut -d: -f2)

docker build \
--build-arg CACHEBUST_APPS=$(cat $REPO_ROOT/.cachebust-apps 2>/dev/null) \
--build-arg CACHEBUST_DOTFILES=$(cat $REPO_ROOT/.cachebust-dotfiles 2>/dev/null) \
--build-arg DESKTOP_ENVIRONMENT_CONTAINER_GIT_SHA=$(git --git-dir $REPO_ROOT/.git rev-parse HEAD | cut -b 1-7) \
--build-arg DESKTOP_ENVIRONMENT_CONTAINER_BUILD_DATE=$(date +%s) \
--build-arg DESKTOP_ENVIRONMENT_CONTAINER_IMAGE_NAME="$DESKTOP_ENVIRONMENT_REGISTRY/$DESKTOP_ENVIRONMENT_CONTAINER_IMAGE" \
--build-arg DESKTOP_ENVIRONMENT_HOST_USER_PASSWORD="$DESKTOP_ENVIRONMENT_HOST_USER_PASSWORD" \
--build-arg DESKTOP_ENVIRONMENT_USER="$DESKTOP_ENVIRONMENT_USER" \
--build-arg DESKTOP_ENVIRONMENT_GITHUB_USER="$DESKTOP_ENVIRONMENT_GITHUB_USER" \
--build-arg DOTFILES_CACHEBUST=$(cat $REPO_ROOT/.dotfiles-cachebust 2>/dev/null) \
--file $REPO_ROOT/docker/Dockerfile \
--tag $DESKTOP_ENVIRONMENT_REGISTRY/$DESKTOP_ENVIRONMENT_CONTAINER_IMAGE:$DESKTOP_ENVIRONMENT_CONTAINER_TAG \
--tag $DESKTOP_ENVIRONMENT_REGISTRY/$DESKTOP_ENVIRONMENT_CONTAINER_IMAGE:latest \
Expand Down

0 comments on commit 848edd5

Please sign in to comment.
0