diff --git a/.dockerignore b/.dockerignore index fd22191a7..1f7a1bb34 100644 --- a/.dockerignore +++ b/.dockerignore @@ -16,4 +16,7 @@ yarn-error.log programs/margin-trade/src/lib-expanded.rs programs/mango-v4/src/lib-expanded.rs -keeper/.env \ No newline at end of file +keeper/.env +.env + +ts/client/src/scripts/archive/ts.ts \ No newline at end of file diff --git a/.github/workflows/ci-docker-fly-deploy.yml b/.github/workflows/ci-docker-fly-deploy.yml new file mode 100644 index 000000000..d7a80e3ae --- /dev/null +++ b/.github/workflows/ci-docker-fly-deploy.yml @@ -0,0 +1,35 @@ +name: Deploy to Fly + +on: + workflow_dispatch: + inputs: + appName: + description: 'Fly App Name' + required: true + type: string + imageName: + description: 'Image Name' + description: 'liquidator, keeper, mm, settler' + required: true + type: string + imageTag: + description: 'Docker Image Tag' + required: true + type: string + default: 'latest' + +env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Fly + uses: superfly/flyctl-actions/setup-flyctl@master + + - name: Deploy + run: flyctl deploy -c cd/${{ inputs.imageName }}.toml -a ${{ inputs.appName }} \ No newline at end of file diff --git a/cd/keeper.toml b/cd/keeper.toml new file mode 100644 index 000000000..8d126e8b9 --- /dev/null +++ b/cd/keeper.toml @@ -0,0 +1,6 @@ +app = "mango-keeper" +kill_signal = "SIGTERM" +kill_timeout = 30 + +[build] + dockerfile = "../bin/keeper/Dockerfile.keeper" diff --git a/cd/liquidator.toml b/cd/liquidator.toml new file mode 100644 index 000000000..b6d4f30c5 --- /dev/null +++ b/cd/liquidator.toml @@ -0,0 +1,6 @@ +app = "mango-liquidator" +kill_signal = "SIGTERM" +kill_timeout = 30 + +[build] + dockerfile = "../bin/liquidator/Dockerfile.liquidator" diff --git a/cd/mm.toml b/cd/mm.toml new file mode 100644 index 000000000..e72d808e0 --- /dev/null +++ b/cd/mm.toml @@ -0,0 +1,6 @@ +app = "mango-mm" +kill_signal = "SIGTERM" +kill_timeout = 30 + +[build] + dockerfile = "../ts/client/scripts/mm/Dockerfile.mm" diff --git a/ts/client/scripts/mm/Dockerfile.mm b/ts/client/scripts/mm/Dockerfile.mm new file mode 100644 index 000000000..79345fb45 --- /dev/null +++ b/ts/client/scripts/mm/Dockerfile.mm @@ -0,0 +1,35 @@ +FROM debian:bullseye as builder + +ARG NODE_VERSION=16.17.0 +ARG YARN_VERSION=1.22.19 + +RUN apt-get update; apt install -y curl +RUN curl https://get.volta.sh | bash +ENV VOLTA_HOME /root/.volta +ENV PATH /root/.volta/bin:$PATH +RUN volta install node@${NODE_VERSION} yarn@${YARN_VERSION} + +####################################################################### + +RUN mkdir /app +WORKDIR /app + +COPY . . + +RUN yarn install && yarn run build + +FROM debian:bullseye as run + +LABEL fly_launch_runtime="nodejs" + +COPY --from=builder /root/.volta /root/.volta +COPY --from=builder /app /app + +WORKDIR /app +ENV NODE_ENV production +ENV PATH /root/.volta/bin:$PATH + +RUN adduser --system --group --no-create-home mangouser +USER mangouser + +CMD [ "node", "dist/cjs/src/scripts/mm/market-maker.js" ] \ No newline at end of file