This repository has been archived by the owner on Feb 10, 2025. It is now read-only.
chore: Docker CI #25
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
name: Docker Image CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# - name: Print Docker version | |
# run: docker version | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
push: false | |
load: true | |
tags: hie:${{ github.sha }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
- # Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
# - name: Save Docker image | |
# run: docker save hie:${{ github.sha }} -o hie_${{ github.sha }}.tar | |
# - name: Upload Docker image as artifact | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: docker-image | |
# path: hie_${{ github.sha }}.tar | |
- run: docker image ls | |
- name: Run | |
run: | | |
docker run -d --name hie -p 5888:3000 hie:${{ github.sha }} | |
sleep 10 | |
- name: Test | |
run: | | |
curl --silent --fail http://localhost:5888 || exit 1 |