Skip to content

Commit

Permalink
Create separate deployment for Ten Gateway Frontend (#1909)
Browse files Browse the repository at this point in the history
  • Loading branch information
zkokelj authored May 13, 2024
1 parent 1ec62e8 commit 596ddf0
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/manual-deploy-ten-gateway-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Deploys Ten Gateway Frontend on Azure for Testnet
# Builds the Ten Gateway image, pushes the image to dockerhub and starts the Ten Gateway on Azure VM

name: '[M] Deploy Ten Gateway Frontend'
run-name: '[M] Deploy Ten Gateway Frontend ( ${{ github.event.inputs.testnet_type }} )'
on:
workflow_dispatch:
inputs:
testnet_type:
description: 'Testnet Type'
required: true
default: 'dev-testnet'
type: choice
options:
- 'dev-testnet'
- 'uat-testnet'
- 'sepolia-testnet'

jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment:
name: ${{ github.event.inputs.testnet_type }}
strategy:
fail-fast: false
matrix:
include:
- testnet_type: 'dev-testnet'
GATEWAY_API_URL: 'https://dev-testnet.ten.xyz'
- testnet_type: 'uat-testnet'
GATEWAY_API_URL: 'https://uat-testnet.ten.xyz'
- testnet_type: 'sepolia-testnet'
GATEWAY_API_URL: 'https://testnet.ten.xyz'
steps:
- name: 'Print GitHub variables'
run: |
echo "Selected Testnet Type: ${{ matrix.testnet_type }}"
echo "Gateway API URL: ${{ matrix.GATEWAY_API_URL }}"
- uses: actions/checkout@v3

- name: 'Extract branch name'
shell: bash
run: |
echo "Branch Name: ${GITHUB_REF_NAME}"
echo "BRANCH_NAME=${GITHUB_REF_NAME}" >> $GITHUB_ENV
- name: 'Set up Docker'
uses: docker/setup-buildx-action@v1

- name: 'Login to Azure docker registry'
uses: azure/docker-login@v1
with:
login-server: testnetobscuronet.azurecr.io
username: testnetobscuronet
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: 'Login via Azure CLI'
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Build and Push Docker Image
run: |
DOCKER_BUILDKIT=1 docker build --build-arg GATEWAY_API_URL=${{ matrix.GATEWAY_API_URL }} -t ${{ vars.DOCKER_BUILD_TAG_GATEWAY_FE }} -f ./tools/walletextension/frontend/Dockerfile .
docker push ${{ vars.DOCKER_BUILD_TAG_GATEWAY_FE }}
- name: "Deploy Gateway FE to Azure Container Instances"
uses: "azure/aci-deploy@v1"
with:
resource-group: ${{ secrets.RESOURCE_GROUP }}
dns-name-label: ${{ github.event.inputs.testnet_type }}-ten-gateway
image: ${{ vars.DOCKER_BUILD_TAG_GATEWAY_FE }}
name: ${{ github.event.inputs.testnet_type }}-fe-ten-gateway
location: "uksouth"
restart-policy: "Never"
ports: "80"
cpu: 2
memory: 2
20 changes: 20 additions & 0 deletions tools/walletextension/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use an official Node.js 22 as a parent image
FROM node:22-alpine

WORKDIR /usr/src/app

# ARG for build-time variable (GATEWAY_API_URL)
ARG GATEWAY_API_URL

# ENV for URL to be used in the app
ENV NEXT_PUBLIC_API_GATEWAY_URL=${GATEWAY_API_URL}
ENV PORT=80

# Copy package.json and package-lock.json (or yarn.lock) into the container
COPY package*.json ./

RUN npm install
COPY . .
RUN npm run build
EXPOSE 80
CMD ["npm", "start"]

0 comments on commit 596ddf0

Please sign in to comment.