Switched Docker images on Gitea host
Some checks failed
Build and push Docker image / build (push) Failing after 6m6s
Build and push Docker image / deploy (push) Has been skipped

This commit is contained in:
toast 2024-09-22 04:17:36 +10:00
parent 689f44cf73
commit 26cc4fb093
2 changed files with 24 additions and 34 deletions

View File

@ -16,63 +16,49 @@ jobs:
RUNNER_TOOL_CACHE: /toolcache RUNNER_TOOL_CACHE: /toolcache
steps: steps:
- name: Set up Docker environment
run: |
apt update && apt upgrade -y
DEPS=(
apt-transport-https
ca-certificates
curl
gnupg
lsb-release
python3-pip
libssl-dev
pkg-config
)
for dep in "${DEPS[@]}"; do
apt install -y "$dep"
done
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update && apt install -y docker-ce docker-ce-cli containerd.io
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Checkout - name: Checkout
uses: https://github.com/actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install zstd
run: sudo apt-get update && sudo apt-get install -y zstd
- name: Generate cache key
id: cargo-cache-key
run: |
find ./Cargo.lock -type f -exec sha256sum {} + | sha256sum > hash.txt
cat hash.txt
- name: Cache - name: Cache
uses: https://github.com/actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
id: cache id: cache
with: with:
save-always: true
path: | path: |
$HOME/.cargo/bin/ $HOME/.cargo/bin/
$HOME/.cargo/git/ $HOME/.cargo/git/
$HOME/.cargo/registry/index/ $HOME/.cargo/registry/index/
$HOME/.cargo/registry/cache/ $HOME/.cargo/registry/cache/
target/ target/
key: ${{ runner.os }}-cache-${{ hashFiles('./Cargo.lock') }} key: ${{ runner.os }}-cache-${{ steps.cargo-cache-key.outputs.hash }}
- name: Login to Gitea - name: Login to Gitea
uses: https://github.com/docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with: with:
registry: git.toast-server.net registry: git.toast-server.net
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }} password: ${{ secrets.DOCKER_TOKEN }}
- name: Set up Rust toolchain - name: Set up Rust toolchain
uses: https://github.com/actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0 uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0
with: with:
toolchain: stable toolchain: stable
rustflags: -C target-feature=-crt-static rustflags: -C target-feature=-crt-static
- name: Install zigbuild - name: Install zigbuild
run: | run: |
pip3 install --break-system-packages ziglang pip3 install ziglang
cargo install --locked cargo-zigbuild cargo install --locked cargo-zigbuild
- name: Compile - name: Compile
@ -83,21 +69,22 @@ jobs:
cargo zigbuild --target x86_64-unknown-linux-musl --locked -rF production cargo zigbuild --target x86_64-unknown-linux-musl --locked -rF production
- name: Build and push image - name: Build and push image
uses: https://github.com/docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0 uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
with: with:
context: . context: .
platforms: linux/amd64 platforms: linux/amd64
push: true push: true
tags: git.toast-server.net/toast/kon:master tags: git.toast-server.net/toast/kon:master
cache-from: type=gha cache-from: type=registry,ref=git.toast-server.net/toast/kon:cache
cache-to: type=gha,mode=max cache-to: type=registry,ref=git.toast-server.net/toast/kon:cache,mode=max,image-manifest=true,oci-mediatypes=true
deploy: deploy:
runs-on: alpine-latest runs-on: alpine-latest
needs: build needs: build
steps: steps:
- name: Deploy update - name: Deploy update
uses: https://github.com/appleboy/ssh-action@d732991ab09097d8c8f390d91385b0386e619598 # v1.0.3 uses: appleboy/ssh-action@d732991ab09097d8c8f390d91385b0386e619598 # v1.0.3
with: with:
host: ${{ secrets.SSH_HOST }} host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }} username: ${{ secrets.SSH_USERNAME }}

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
target target
.env .env
*.log *.log
# Local Gitea Actions
act