diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 19d35c0..b6c24bd 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -53,14 +53,12 @@ jobs: else echo "tags=avoylenko/wwebjs-api:${{ github.ref_name }},avoylenko/wwebjs-api:latest" >> $GITHUB_OUTPUT fi - - name: Install edge version of whatsapp-web.js - if: github.ref_name == 'edge' - run: | - npm install --save-exact github:pedroslopez/whatsapp-web.js#main - name: Build and push with dynamic tag uses: docker/build-push-action@v5 with: platforms: linux/amd64,linux/arm64,linux/arm/v7 push: true tags: ${{ steps.meta.outputs.tags }} + build-args: | + USE_EDGE=${{ github.ref_name == 'edge' }} no-cache: ${{ github.ref_name == 'edge' }} diff --git a/Dockerfile b/Dockerfile index a950abf..5850cfd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,9 +9,15 @@ WORKDIR /usr/src/app FROM base AS deps +ARG USE_EDGE=false + COPY package*.json ./ -RUN npm ci --only=production --ignore-scripts +RUN if [ "$USE_EDGE" = "true" ]; then \ + npm install --save-exact --omit=dev --ignore-scripts github:pedroslopez/whatsapp-web.js#main; \ + else \ + npm ci --only=production --ignore-scripts; \ + fi # Create the final stage FROM base