Skip to content

Commit

Permalink
Pass Cloudinary URL as a build-time argument
Browse files Browse the repository at this point in the history
  • Loading branch information
silvenon committed Mar 30, 2024
1 parent 47d96b2 commit bf208da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,16 @@ jobs:
field: "app"

- name: Set up Fly
uses: superfly/flyctl-actions/setup-flyctl@1.5
env:
CLOUDINARY_URL: ${{ secrets.CLOUDINARY_URL }}
uses: superfly/flyctl-actions/setup-flyctl@master

- name: Deploy Staging
if: ${{ github.ref == 'refs/heads/dev' }}
run: flyctl deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }} --app ${{ steps.app_name.outputs.value }}-staging
run: flyctl deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }} --build-arg CLOUDINARY_URL=${{ secrets.CLOUDINARY_URL }} --app ${{ steps.app_name.outputs.value }}-staging
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

- name: Deploy Production
if: ${{ github.ref == 'refs/heads/main' }}
run: flyctl deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }} --app ${{ steps.app_name.outputs.value }}
run: flyctl deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }} --build-arg CLOUDINARY_URL=${{ secrets.CLOUDINARY_URL }} --app ${{ steps.app_name.outputs.value }}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ RUN npm prune --omit=dev
# Build the app
FROM base as build

ARG CLOUDINARY_URL

WORKDIR /app

COPY --from=deps /app/node_modules /app/node_modules

COPY . .
RUN npm run build
RUN CLOUDINRAY_URL=${CLOUDINRAY_URL} npm run build

# Finally, build the production image with minimal footprint
FROM base
Expand Down

0 comments on commit bf208da

Please sign in to comment.