Skip to content

Commit

Permalink
test: use npm
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsuk1ko committed Nov 24, 2023
1 parent 7904f12 commit ab4e7c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 60 deletions.
61 changes: 4 additions & 57 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,10 @@ on:

env:
REGISTRY_IMAGE: tsuk1ko/cq-picsearcher-bot
NEED_PUSH: ${{ github.event_name != 'workflow_dispatch' || inputs.push }}

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -44,60 +37,14 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push by digest
id: build
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.platform }}
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'workflow_dispatch' || inputs.push }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=${{ env.NEED_PUSH }}
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v3
with:
name: digests
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge:
if: ${{ github.event_name != 'workflow_dispatch' || inputs.push }}
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download digests
uses: actions/download-artifact@v3
with:
name: digests
path: /tmp/digests
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
- name: Checkout
uses: actions/checkout@v4
- name: Update repo description
uses: peter-evans/dockerhub-description@v3
with:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ FROM nikolaik/python-nodejs:python3.12-nodejs18 as build
COPY . /app

RUN cd /app \
&& yarn global add node-gyp \
&& yarn prepare:docker \
&& yarn --production
&& npm i -g node-gyp \
&& npm run prepare:docker \
&& npm i --production



Expand Down

0 comments on commit ab4e7c7

Please sign in to comment.