Skip to content
Open
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
111 changes: 0 additions & 111 deletions .github/workflows/build.yml

This file was deleted.

109 changes: 109 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: CI

on:
push:
branches: staging

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
################################################################################ BUILD
build-image:
runs-on: ubuntu-latest
outputs:
image-tag: ${{ steps.image-tag.outputs.tag }}

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: '0'

- if: ${{ github.ref == 'refs/heads/master' }}
name: Bump version and push tag
uses: anothrNick/github-tag-action@1.36.0
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
WITH_V: false

- id: image-tag
run: |
if [ ${{ github.ref }} == 'refs/heads/master' ]; then
echo "::set-output name=tag::$(git describe --tags $(git rev-list --tags --max-count=1))"
elif [ ${{ github.ref }} == 'refs/heads/staging' ]; then
echo "::set-output name=tag::staging-$(git rev-parse --short HEAD)"
fi

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

- name: Build image & save to tmp
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
tags: stackos/${{ secrets.PROJECT_NAME }}:${{ steps.image-tag.outputs.tag }}
outputs: type=docker,dest=/tmp/myimage.tar

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: myimage
path: /tmp/myimage.tar

################################################################################ PUSH
push-image:
runs-on: ubuntu-latest
needs: build-image

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download artifact
uses: actions/download-artifact@v2
with:
name: myimage
path: /tmp

- name: Load image
run: |
docker load --input /tmp/myimage.tar
docker image ls -a

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Push image
run: |
docker push stackos/${{ secrets.PROJECT_NAME }}:${{ needs.build-image.outputs.image-tag }}

- name: Remove temp docker image
run: |
rm -rf /tmp/myimage.tar

############################################################################### DEPLOY-STAGING
deploy-to-gke-staging:
if: ${{ github.ref == 'refs/heads/staging' }}
runs-on: ubuntu-latest
needs: [build-image, push-image]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Get GKE Credentials
uses: 'google-github-actions/get-gke-credentials@v0.2.1'
with:
cluster_name: ${{ secrets.MARVEL_CLUSTER_NAME }}
location: 'us-central1'
credentials: ${{ secrets.MARVEL_GCP_CREDENTIALS }}

- name: Deploy Docker image to GKE - Staging
run: |
kubectl patch deployment ${{ secrets.PROJECT_NAME }}-${{ secrets.MARVEL_CLUSTER_NAME }} --namespace ${{ secrets.NAMESPACE }} -p '{"spec":{"template":{"spec":{"containers":[{"name":"${{ secrets.PROJECT_NAME }}-${{ secrets.MARVEL_CLUSTER_NAME }}","image":"stackos/${{ secrets.PROJECT_NAME }}:${{ needs.build-image.outputs.image-tag }}"}]}}}}'
kubectl describe deployments.apps ${{ secrets.PROJECT_NAME }}-${{ secrets.MARVEL_CLUSTER_NAME }} --namespace ${{ secrets.NAMESPACE }} |grep -i image
kubectl get po --namespace ${{ secrets.NAMESPACE }} |grep ${{ secrets.PROJECT_NAME }}-${{ secrets.MARVEL_CLUSTER_NAME }}
26 changes: 0 additions & 26 deletions .github/workflows/testnet.yml

This file was deleted.

3 changes: 3 additions & 0 deletions bridge_ui/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
build
.dockerignore
12 changes: 12 additions & 0 deletions bridge_ui/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
REACT_APP_PRIMARY_COLOR="#2abfff"
REACT_APP_SECONDARY_COLOR="#ffffff12"
REACT_APP_BODY_COLOR="#16171b"
REACT_APP_TEXT_COLOR="#ffffff"
REACT_APP_LOGO="https://www.linkpicture.com/q/logo_12.svg"
REACT_APP_TITLE="Token Bridge"
REACT_APP_SUBTITLE="Portal is a bridge that offers unlimited transfers across chains for tokens and NFTs wrapped by Wormhole. Unlike many other bridges, you avoid double wrapping and never have to retrace your steps."
REACT_APP_LINK_NAME="StackOS"
REACT_APP_LINK_ADDRESS="https://www.home.stackos.io/"
REACT_APP_CLUSTER="mainnet"
REACT_APP_ALLOWED_CHAINS="Ethereum:0x56a86d648c435dc707c8405b78e2ae8eb4e60ba4,Binance Smart Chain:0x6855f7bb6287f94ddcc8915e37e73a3c9fee5cf3,Polygon:0x980111ae1b84e50222c8843e3a7a038f36fecd2b"
REACT_APP_COVALENT_API_KEY=ckey_ac8f912a507e48b2bdd57a6c795
6 changes: 5 additions & 1 deletion bridge_ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ yarn-error.log*

# ethereum contracts
/contracts
/src/ethers-contracts
/src/ethers-contracts

# Temporary env files
/public/env-config.js
env-config.js
47 changes: 42 additions & 5 deletions bridge_ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,49 @@
# syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2

# Derivative of ethereum/Dockerfile, look there for an explanation on how it works.
FROM node:16-alpine@sha256:f21f35732964a96306a84a8c4b5a829f6d3a0c5163237ff4b6b8b34f8d70064b
FROM node:16-alpine@sha256:f21f35732964a96306a84a8c4b5a829f6d3a0c5163237ff4b6b8b34f8d70064b as builder

RUN apk add g++ make
RUN mkdir -p /app
WORKDIR /app

COPY bridge_ui/package.json bridge_ui/package-lock.json ./
RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
npm ci
COPY bridge_ui .
#COPY package.json package-lock.json ./
COPY package.json .

COPY . .
RUN npm install
RUN npm run build

#RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
# npm ci
# add app
#COPY . ./


# => Run container
FROM nginx:1.15.2-alpine

# Nginx config
RUN rm -rf /etc/nginx/conf.d
COPY conf /etc/nginx

# Static build
COPY --from=builder /app/build /usr/share/nginx/html/

# Default port exposure
EXPOSE 80

# Copy .env file and shell script to container
WORKDIR /usr/share/nginx/html
COPY ./env.sh .
COPY .env .

# Add bash
RUN apk add --no-cache bash

# Make our shell script executable
RUN chmod +x env.sh

# Start Nginx server
# CMD ["/bin/sh", "-c", "nginx -g \"daemon off;\""]
CMD ["/bin/sh", "-c", "/usr/share/nginx/html/env.sh && sleep 30 && nginx -g \"daemon off;\""]
Loading