parent
3e1009bbb4
commit
cfc27f63d6
|
@ -0,0 +1,59 @@
|
|||
name: Publish Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
# use this tag to test CI build for this workflow without merging into main branch
|
||||
- experimental-github-actions
|
||||
|
||||
env:
|
||||
IMAGE: mango-feeds
|
||||
ORG: blockworks-foundation
|
||||
REGISTRY: ghcr.io
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set rust version
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" | tee -a $GITHUB_ENV
|
||||
|
||||
# Use docker buildx
|
||||
- name: Use docker buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
id: buildx
|
||||
with:
|
||||
install: true
|
||||
buildkitd-flags: --debug
|
||||
|
||||
# Login to Registry
|
||||
- name: Login to Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# Build and push the image
|
||||
- name: Build and Push Image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
build-args: |
|
||||
RUST_TOOLCHAIN_VERSION=${{ env.RUST_STABLE }}
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE }}:${{ github.sha }}
|
||||
${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE }}:latest
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
|
@ -1,31 +0,0 @@
|
|||
name: Deploy to Fly
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Publish Docker Image"]
|
||||
branches: [production]
|
||||
types:
|
||||
- completed
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
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
|
|
@ -0,0 +1,26 @@
|
|||
# syntax = docker/dockerfile:1.2
|
||||
# Base image containing all binaries, deployed to gcr.io/mango-markets/mango-geyser-services:latest
|
||||
ARG RUST_TOOLCHAIN_VERSION
|
||||
FROM rust:${RUST_TOOLCHAIN_VERSION}-bullseye as base
|
||||
RUN cargo install cargo-chef
|
||||
RUN rustup component add rustfmt
|
||||
RUN apt-get update && apt-get install -y clang cmake ssh
|
||||
WORKDIR /app
|
||||
|
||||
FROM base AS plan
|
||||
COPY . .
|
||||
WORKDIR /app
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
FROM base as build
|
||||
COPY --from=plan /app/recipe.json recipe.json
|
||||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
COPY . .
|
||||
RUN cargo build --release --bin service-mango-fills --bin service-mango-pnl --bin service-mango-orderbook
|
||||
|
||||
FROM debian:bullseye-slim as run
|
||||
RUN apt-get update && apt-get -y install ca-certificates libc6
|
||||
COPY --from=build /app/target/release/service-mango-* /usr/local/bin/
|
||||
COPY --from=build /app/service-mango-pnl/conf/template-config.toml ./pnl-config.toml
|
||||
COPY --from=build /app/service-mango-fills/conf/template-config.toml ./fills-config.toml
|
||||
COPY --from=build /app/service-mango-orderbook/conf/template-config.toml ./orderbook-config.toml
|
Loading…
Reference in New Issue