Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions .github/workflows/node.js.yml

This file was deleted.

63 changes: 62 additions & 1 deletion .github/workflows/ousd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,65 @@ jobs:
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high --all-projects
args: --severity-threshold=high --all-projects

build-image:
name: "Deploy App"
runs-on: ubuntu-latest
needs: [contracts-lint, dapp-lint]
env:
HEROKU_TOKEN: ${{ secrets.HEROKU_TOKEN }}
CURR_BRANCH: ${{ github.ref_name }}
if: ${{ contains(fromJSON('["master", "staging", "stable"]'), github.ref_name) }}
steps:
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Run Docker Login
run: docker login --username =_ --password=$HEROKU_TOKEN registry.heroku.com

- name: Identify Heroku App Name
shell: bash
run:
if [[ $CURR_BRANCH == "stable" ]]; then
echo "HEROKU_APP_NAME=ousd-dapp" >> $GITHUB_ENV;
else
echo "HEROKU_APP_NAME=ousd-dapp-staging" >> $GITHUB_ENV;
fi;
id: heroku_app

- name: Heroku Login
uses: akhileshns/heroku-deploy@v3.12.12
if: ${{ contains(fromJSON('["staging", "stable"]'), github.ref_name) }}
with:
justlogin: true
heroku_api_key: ${{secrets.HEROKU_TOKEN}}
heroku_app_name: ${{env.HEROKU_APP_NAME}}
heroku_email: ${{secrets.HEROKU_EMAIL}}

- name: Extract Deployment Env
env:
HEROKU_APP_NAME: ${{env.HEROKU_APP_NAME}}
working-directory: dapp
run: heroku config -s -a $HEROKU_APP_NAME > deploy.env
- name: Build and Push
uses: docker/build-push-action@v3
if: ${{ contains(fromJSON('["staging", "stable"]'), github.ref_name) }}
env:
NODE_ENV: production
with:
context: .
push: true
tags: registry.heroku.com/${{env.HEROKU_APP_NAME}}/web
provenance: false

- name: Deploy to Heroku
if: ${{ contains(fromJSON('["staging", "stable"]'), github.ref_name) }}
env:
HEROKU_APP_NAME: ${{env.HEROKU_APP_NAME}}
run: heroku container:release web -a $HEROKU_APP_NAME
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:16-alpine

# Install Git
RUN apk update
RUN apk add git

# Copy files over
WORKDIR /app
COPY contracts ./contracts
COPY dapp ./dapp

# Build contract files
WORKDIR /app/contracts
RUN yarn install
RUN yarn deploy

# Build DApp
WORKDIR /app/dapp
RUN yarn install
RUN NODE_ENV=production yarn build

CMD ["yarn", "start"]
2 changes: 1 addition & 1 deletion dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"ipfs-export": "DEPLOY_MODE=ipfs yarn run build && next export",
"start": "per-env",
"start:development": "NODE_ENV=development ETHEREUM_RPC_PROVIDER=http://localhost:8545 next dev",
"start:production": "NODE_ENV=production next start -p 8080",
"start:production": "NODE_ENV=production next start -p $PORT",
"gcp-build": "next build",
"encrypt-secrets:prod": "gcloud kms encrypt --ciphertext-file=prod.secrets.enc --plaintext-file=prod.env --location=global --keyring=origin --key=cloudbuild",
"decrypt-secrets:prod": "gcloud kms decrypt --ciphertext-file=prod.secrets.enc --plaintext-file=prod.env --location=global --keyring=origin --key=cloudbuild",
Expand Down
3 changes: 3 additions & 0 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build:
docker:
web: Dockerfile