Docker Community Forums

Share and learn in the Docker community.

The Error: Requires exactly one target process type, or --recursive option

hello all,
i got this error on github action diploy…

Error: Requires exactly one target process type, or --recursive option

this is the dockerF

# Install dependencies only when needed
FROM node:16-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.

RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci 

FROM node:16-alpine AS builder 

ENV NEXT_PUBLIC_DATABASE_CONNECTION: "${NEXT_PUBLIC_DATABASE_CONNECTION}"      
ENV NEXT_PUBLIC_JWT_TOKEN_SECRET: "${NEXT_PUBLIC_JWT_TOKEN_SECRET}"
ENV NEXT_PUBLIC_PAYPAL_CLIENT_ID: "${NEXT_PUBLIC_PAYPAL_CLIENT_ID}"
ENV NEXT_PUBLIC_PAYPAL_SECRET: "${NEXT_PUBLIC_PAYPAL_SECRET}"
ENV NEXT_PUBLIC_CLOUDINARY_NAME: "${NEXT_PUBLIC_CLOUDINARY_NAME}"
ENV NEXT_PUBLIC_API_KEY: "${NEXT_PUBLIC_API_KEY}"
ENV NEXT_PUBLIC_API_SECRET: "${NEXT_PUBLIC_API_SECRET}"
ENV NEXT_PUBLIC_GOOGLE_MAP_API: "${NEXT_PUBLIC_GOOGLE_MAP_API}"


WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
RUN npm run build && npm install --production --ignore-scripts --prefer-offline 


# Production image, copy all the files and run next
FROM node:16-alpine AS runner
WORKDIR /app


ENV NODE_ENV production
ENV NEXT_PUBLIC_DATABASE_CONNECTION: "${NEXT_PUBLIC_DATABASE_CONNECTION}"      
ENV NEXT_PUBLIC_JWT_TOKEN_SECRET: "${NEXT_PUBLIC_JWT_TOKEN_SECRET}"
ENV NEXT_PUBLIC_PAYPAL_CLIENT_ID: "${NEXT_PUBLIC_PAYPAL_CLIENT_ID}"
ENV NEXT_PUBLIC_PAYPAL_SECRET: "${NEXT_PUBLIC_PAYPAL_SECRET}"
ENV NEXT_PUBLIC_CLOUDINARY_NAME: "${NEXT_PUBLIC_CLOUDINARY_NAME}"
ENV NEXT_PUBLIC_API_KEY: "${NEXT_PUBLIC_API_KEY}"
ENV NEXT_PUBLIC_API_SECRET: "${NEXT_PUBLIC_API_SECRET}"
ENV NEXT_PUBLIC_GOOGLE_MAP_API: "${NEXT_PUBLIC_GOOGLE_MAP_API}"

RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001

# You only need to copy next.config.js if you are NOT using the default configuration
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json

# Automatically leverage output traces to reduce image size 
# https://nextjs.org/docs/advanced-features/output-file-tracing
 COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000

ENV PORT 3000

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry.
# ENV NEXT_TELEMETRY_DISABLED 1

CMD ["npm", "run", "start"]

this is the yml

# https://github.com/marketplace/actions/deploy-to-heroku
name: Deploy

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2 
      - name: Deploy to Heroku
        uses: akhileshns/heroku-deploy@v3.12.12 # This is the action
        with:
          heroku_api_key: ${{secrets.HEROKU_API_KEY}}
          heroku_app_name: "shopping-cart-6-cd" #Must be unique in Heroku
          heroku_email: "******"
          usedocker: true
          # buildpack enable you to extend Heroku's build system to support your language or customizations, or to make particular binary packages available to the runtime.
          buildpack: "https://github.com/HashNuke/heroku-buildpack-elixir.git"
          stack: "container"
          # healthcheck: "https://shopping-cart-6-cd.herokuapp.com/health" 
          # checkstring: "ok"
          # rollbackonhealthcheckfailed: true
          docker_build_args: |
            NODE_ENV                        
            NEXT_PUBLIC_DATABASE_CONNECTION
            NEXT_PUBLIC_JWT_TOKEN_SECRET
            NEXT_PUBLIC_PAYPAL_CLIENT_ID
            NEXT_PUBLIC_PAYPAL_SECRET
            NEXT_PUBLIC_CLOUDINARY_NAME
            NEXT_PUBLIC_API_KEY
            NEXT_PUBLIC_API_SECRET
            NEXT_PUBLIC_GOOGLE_MAP_API      
      
        env:
          NODE_ENV: production
          NEXT_PUBLIC_DATABASE_CONNECTION: "${NEXT_PUBLIC_DATABASE_CONNECTION}"
          NEXT_PUBLIC_JWT_TOKEN_SECRET: "${NEXT_PUBLIC_JWT_TOKEN_SECRET}"
          NEXT_PUBLIC_PAYPAL_CLIENT_ID: "${NEXT_PUBLIC_PAYPAL_CLIENT_ID}"
          NEXT_PUBLIC_PAYPAL_SECRET: "${NEXT_PUBLIC_PAYPAL_SECRET}"
          NEXT_PUBLIC_CLOUDINARY_NAME: "${NEXT_PUBLIC_CLOUDINARY_NAME}"
          NEXT_PUBLIC_API_KEY: "${NEXT_PUBLIC_API_KEY}"
          NEXT_PUBLIC_API_SECRET: "${NEXT_PUBLIC_API_SECRET}"
          NEXT_PUBLIC_GOOGLE_MAP_API: "${NEXT_PUBLIC_GOOGLE_MAP_API}"
        if: always()

thans

Please, don’t ask the same question twice! I guess it was just an accident. In the future, make sure you edit the post instead of creating a new one.

I close this topic and keep it because it seems it adds different details.

Continue the discussion in the other topic: