Simplify CI
All checks were successful
Build Docker image and publish / docker (push) Successful in 1m52s
All checks were successful
Build Docker image and publish / docker (push) Successful in 1m52s
This commit is contained in:
parent
a9b12afe85
commit
8a72a4c796
1 changed files with 33 additions and 12 deletions
|
@ -24,19 +24,40 @@ jobs:
|
||||||
id: env
|
id: env
|
||||||
run: |
|
run: |
|
||||||
echo "DOCKER_TAG=$DOCKER_REPOSITORY/$(echo "$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]'):latest" >> "$GITHUB_ENV"
|
echo "DOCKER_TAG=$DOCKER_REPOSITORY/$(echo "$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]'):latest" >> "$GITHUB_ENV"
|
||||||
apk add --no-cache git nodejs
|
apk add --no-cache git nodejs tar zstd
|
||||||
|
|
||||||
- name: "Login to Docker repository"
|
|
||||||
id: login
|
|
||||||
run: docker login -u "$GITHUB_ACTOR" -p "${{ secrets.PACKAGE_TOKEN }}" "$DOCKER_REPOSITORY"
|
|
||||||
|
|
||||||
- name: "Get repo"
|
- name: "Get repo"
|
||||||
uses: https://code.forgejo.org/actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: "Build Docker image"
|
- name: "Restore cache"
|
||||||
id: build
|
id: cache-restore
|
||||||
run: docker buildx build --pull --platform linux/amd64 -t "$DOCKER_TAG" .
|
uses: actions/cache/restore@v4
|
||||||
|
with:
|
||||||
|
path: "${{ env.GITHUB_WORKSPACE }}/.docker_cache"
|
||||||
|
key: "docker"
|
||||||
|
|
||||||
- name: "Publish Docker image"
|
- name: Set up Docker Buildx
|
||||||
id: push
|
uses: https://github.com/docker/setup-buildx-action@v3
|
||||||
run: docker push "$DOCKER_TAG"
|
|
||||||
|
- name: "Login to Docker repository"
|
||||||
|
uses: https://github.com/docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: "${{ env.DOCKER_REPOSITORY }}"
|
||||||
|
username: "${{ env.GITHUB_ACTOR }}"
|
||||||
|
password: "${{ secrets.PACKAGE_TOKEN }}"
|
||||||
|
|
||||||
|
- name: "Build and push"
|
||||||
|
uses: https://github.com/docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: "${{ env.DOCKER_TAG }}"
|
||||||
|
cache-from: "type=local,src=${{ env.GITHUB_WORKSPACE }}/.docker_cache"
|
||||||
|
cache-to: "type=local,dest=${{ env.GITHUB_WORKSPACE }}/.docker_cache"
|
||||||
|
|
||||||
|
- name: "Save cache"
|
||||||
|
id: cache-save
|
||||||
|
uses: actions/cache/save@v4
|
||||||
|
with:
|
||||||
|
path: "${{ env.GITHUB_WORKSPACE }}/.docker_cache"
|
||||||
|
key: "${{ steps.cache-restore.outputs.cache-primary-key }}"
|
||||||
|
|
Loading…
Reference in a new issue