ElayGelbart / Heroku-Auto-Deployment

MIT License
23 stars 11 forks source link

env secret not passing #8

Closed 1xo2 closed 2 years ago

1xo2 commented 2 years ago

it will be great if you could give an example how to pass env secret, in my case without the env its working as expected.

this is the error i get

failed to process "${{secrets.NEXT_PUBLIC_DATABASE_CONNECTION}}": syntax error: bad substitution

the yml

`name: Publish To Heroku With Docker on: push: branches: [master]

jobs: publish: runs-on: ubuntu-latest steps:

the Dockerfile

` FROM node:16-alpine AS deps RUN apk add --no-cache libc6-compat WORKDIR /app COPY package.json package-lock.json ./ RUN npm ci

FROM node:16-alpine AS builder

ARG NEXT_PUBLIC_DATABASE_CONNECTION

ENV NEXT_PUBLIC_DATABASE_CONNECTION: ${{secrets.NEXT_PUBLIC_DATABASE_CONNECTION}}

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

FROM node:16-alpine AS runner WORKDIR /app

ARG NEXT_PUBLIC_DATABASE_CONNECTION

ENV NEXT_PUBLIC_DATABASE_CONNECTION: ${{ secrets.NEXT_PUBLIC_DATABASE_CONNECTION }}

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

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

COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 8000

ENV PORT 8000

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

ElayGelbart commented 2 years ago

looks like a bug unrelated to this GH Action, Issue CLosed