-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32a0077
commit 2b53819
Showing
1 changed file
with
13 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,35 +13,35 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get Docker cache digest | ||
id: get-cache-digest | ||
run: echo "::set-output name=digest::$(sha256sum docker-compose.yml | awk '{ print $1 }')" | ||
# Checkout the repository | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Set up Docker Buildx | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
# Cache Docker layers | ||
- name: Cache Docker layers | ||
id: cache-docker-layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-docker-${{ steps.get-cache-digest.outputs.digest }} | ||
key: ${{ runner.os }}-docker-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-docker- | ||
- name: Run docker-compose | ||
uses: hoverkraft-tech/[email protected] | ||
with: | ||
compose-file: "docker-compose.yml" | ||
# Build Docker image | ||
- name: Build Docker image | ||
run: | | ||
docker buildx build --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache,mode=max -t my-cpp-image -f docker/image/Dockerfile . | ||
- name: Build and Run Docker Containers | ||
# Run Docker container | ||
- name: Run Docker Compose | ||
run: | | ||
docker buildx build --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache,mode=max . | ||
docker compose up --abort-on-container-exit --exit-code-from bmstu | ||
# Save Docker layer cache | ||
- name: Save Docker layer cache | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
|