-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: publish_package | ||
|
||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
tags: | ||
- "ibc-routing[0-9]+.[0-9]+.[0-9]+" | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 # Ensure using the latest release | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 # Updated to the latest version | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v3 # Updated to the latest version | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 # Updated to the latest version | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v3 # Updated to the latest version | ||
with: | ||
context: . | ||
file: ./Dockerfile.ibc | ||
push: true | ||
tags: devorai/oraidex-ibc-routing:${{ github.ref_name }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
|
||
swarm: | ||
runs-on: orai-swarm | ||
needs: build | ||
steps: | ||
- name: Deploy to Swarm | ||
run: | | ||
curl -X POST \ | ||
${{ secrets.WEBHOOK_IBC_ROUTING_SERVICE }}?tag=${{ github.ref_name }} | ||
- name: Send discord message | ||
uses: appleboy/discord-action@master | ||
with: | ||
webhook_id: ${{ secrets.WEBHOOK_ID }} | ||
webhook_token: ${{ secrets.WEBHOOK_TOKEN }} | ||
username: "GitBot" | ||
message: ":loudspeaker: Repo oraidex-sdk:ibc-routing has just deployed to swarm with tag: ${{ github.ref_name }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Use the official Node.js 18 image. | ||
# https://hub.docker.com/_/node | ||
FROM node:18.18.0 AS builder | ||
|
||
# Install global package | ||
RUN yarn global add tsx tsc patch-package lerna nx | ||
|
||
# Create app directory. | ||
WORKDIR /app | ||
|
||
# Create server folder path | ||
RUN mkdir -p packages/ibc-routing | ||
RUN mkdir -p packages/oraidex-common | ||
|
||
# Copy application dependency manifests to the container image. | ||
# A wildcard is used to ensure both package.json AND package-lock.json are copied. | ||
# Copying this separately prevents re-running npm install on every code change. | ||
COPY lerna.json package.json tsconfig.json ./ | ||
COPY packages/ibc-routing/package*.json packages/ibc-routing/tsconfig.json ./packages/ibc-routing/ | ||
COPY packages/oraidex-common/package*.json packages/oraidex-common/tsconfig.json ./packages/oraidex-common/ | ||
|
||
# Install production dependencies. | ||
RUN yarn | ||
|
||
# Copy local code to the container image. | ||
COPY packages/ibc-routing/. ./packages/ibc-routing/ | ||
COPY packages/oraidex-common/. ./packages/oraidex-common/ | ||
|
||
# Use the TypeScript compiler to build the application. | ||
RUN yarn build | ||
|
||
# Change to the app directory. | ||
WORKDIR /app/packages/ibc-routing | ||
|
||
# Run the web service on container startup. | ||
CMD [ "yarn", "prod" ] |