diff --git a/.github/workflows/ci-docker-fly-deploy.yml b/.github/workflows/ci-docker-fly-deploy.yml index d7a80e3ae..a5adbd6f7 100644 --- a/.github/workflows/ci-docker-fly-deploy.yml +++ b/.github/workflows/ci-docker-fly-deploy.yml @@ -8,8 +8,7 @@ on: required: true type: string imageName: - description: 'Image Name' - description: 'liquidator, keeper, mm, settler' + description: 'Docker Image Name' required: true type: string imageTag: diff --git a/.github/workflows/ci-docker-publish.yml b/.github/workflows/ci-docker-publish.yml index d1e2172b1..939a572f2 100644 --- a/.github/workflows/ci-docker-publish.yml +++ b/.github/workflows/ci-docker-publish.yml @@ -12,17 +12,11 @@ on: 'bin/liquidator/**', 'bin/settler/**', ] - workflow_call: - secrets: - GCR_PROJECT: - required: true - GCR_SA_KEY: - required: true workflow_dispatch: env: - PROJECT_ID: ${{ secrets.GCR_PROJECT }} IMAGE: mango-v4 + REGISTRY: ghcr.io jobs: build: @@ -41,21 +35,13 @@ jobs: install: true buildkitd-flags: --debug - # Login to Google Cloud - - name: 'Login to Google Cloud' - uses: 'google-github-actions/auth@v0' - id: auth - with: - token_format: 'access_token' - credentials_json: '${{ secrets.GCR_SA_KEY }}' - - # Login to GCR - - name: Login to GCR + # Login to Registry + - name: Login to Registry uses: docker/login-action@v2 with: - registry: us-docker.pkg.dev - username: oauth2accesstoken - password: ${{ steps.auth.outputs.access_token }} + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} # Build and push the base image, leveraging layer caching - name: Build and Push Base Image @@ -64,37 +50,7 @@ jobs: context: . push: true tags: | - us-docker.pkg.dev/${{ env.PROJECT_ID }}/gcr.io/${{ env.IMAGE }}:${{ github.sha }} - us-docker.pkg.dev/${{ env.PROJECT_ID }}/gcr.io/${{ env.IMAGE }}:latest + ${{ env.REGISTRY }}/blockworks-foundation/${{ env.IMAGE }}:${{ github.sha }} + ${{ env.REGISTRY }}/blockworks-foundation/${{ env.IMAGE }}:latest cache-from: type=gha cache-to: type=gha,mode=max - # Build and push the liquidator runtime image - - name: Build and Push Liquidator - uses: docker/build-push-action@v2 - with: - file: bin/liquidator/Dockerfile.liquidator - context: . - push: true - tags: | - us-docker.pkg.dev/${{ env.PROJECT_ID }}/gcr.io/${{ env.IMAGE }}-liquidator:${{ github.sha }} - us-docker.pkg.dev/${{ env.PROJECT_ID }}/gcr.io/${{ env.IMAGE }}-liquidator:latest - # Build and push the settler runtime image - - name: Build and Push Settle Bot - uses: docker/build-push-action@v2 - with: - file: bin/settler/Dockerfile.settler - context: . - push: true - tags: | - us-docker.pkg.dev/${{ env.PROJECT_ID }}/gcr.io/${{ env.IMAGE }}-settler:${{ github.sha }} - us-docker.pkg.dev/${{ env.PROJECT_ID }}/gcr.io/${{ env.IMAGE }}-settler:latest - # Build and push the keeper runtime image - - name: Build and Push Keeper - uses: docker/build-push-action@v2 - with: - file: bin/keeper/Dockerfile.keeper - context: . - push: true - tags: | - us-docker.pkg.dev/${{ env.PROJECT_ID }}/gcr.io/${{ env.IMAGE }}-keeper:${{ github.sha }} - us-docker.pkg.dev/${{ env.PROJECT_ID }}/gcr.io/${{ env.IMAGE }}-keeper:latest diff --git a/Dockerfile b/Dockerfile index 813c8ba04..3c9268e5e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # syntax = docker/dockerfile:1.2 -# Base image containing all binaries, deployed to gcr.io/mango-markets/mango-v4:latest +# Base image containing all binaries, deployed to ghcr.io/blockworks-foundation/mango-v4:latest FROM rust:1.65 as base # RUN cargo install cargo-chef --locked RUN rustup component add rustfmt @@ -12,15 +12,13 @@ COPY . . RUN sed -i 's|lib/\*|lib/checked_math|' Cargo.toml # Hack to prevent local serum_dex manifests conflicting with cargo dependency RUN rm -rf anchor/tests -# RUN cargo chef prepare --bin keeper --recipe-path recipe-keeper.json -# RUN cargo chef prepare --bin liquidator --recipe-path recipe-liquidator.json +# RUN cargo chef prepare --recipe-path recipe.json FROM base as build -COPY --from=plan /app/recipe-*.json . +# COPY --from=plan /app/recipe.json . COPY . . -# RUN cargo chef cook --release --recipe-path recipe-keeper.json --bin keeper -# RUN cargo chef cook --release --recipe-path recipe-liquidator.json --bin liquidator -RUN cargo build --release --bin keeper --bin liquidator --bin settler +# RUN cargo chef cook --release --recipe-path recipe.json +RUN cargo build --release --bins FROM debian:bullseye-slim as run RUN apt-get update && apt-get -y install ca-certificates libc6 diff --git a/bin/keeper/Dockerfile.keeper b/bin/keeper/Dockerfile.keeper index 678453100..81c2bc32a 100644 --- a/bin/keeper/Dockerfile.keeper +++ b/bin/keeper/Dockerfile.keeper @@ -2,7 +2,7 @@ # heroku container:push keeper -R -a HEROKU_APP_NAME # heroku container:release -a HEROKU_APP_NAME ARG BASE_TAG=latest -FROM us-docker.pkg.dev/mango-markets/gcr.io/mango-v4:$BASE_TAG +FROM ghcr.io/blockworks-foundation/mango-v4:$BASE_TAG ENTRYPOINT ["keeper"] USER mangouser CMD ["crank"] diff --git a/bin/liquidator/Dockerfile.liquidator b/bin/liquidator/Dockerfile.liquidator index 2e915be4a..89a4b5e62 100644 --- a/bin/liquidator/Dockerfile.liquidator +++ b/bin/liquidator/Dockerfile.liquidator @@ -2,6 +2,6 @@ # heroku container:push keeper -R -a HEROKU_APP_NAME # heroku container:release -a HEROKU_APP_NAME ARG BASE_TAG=latest -FROM us-docker.pkg.dev/mango-markets/gcr.io/mango-v4:$BASE_TAG +FROM ghcr.io/blockworks-foundation/mango-v4:$BASE_TAG USER mangouser CMD ["liquidator"] diff --git a/bin/settler/Dockerfile.settler b/bin/settler/Dockerfile.settler index 3a7a34854..0ec1edb15 100644 --- a/bin/settler/Dockerfile.settler +++ b/bin/settler/Dockerfile.settler @@ -2,6 +2,6 @@ # heroku container:push keeper -R -a HEROKU_APP_NAME # heroku container:release -a HEROKU_APP_NAME ARG BASE_TAG=latest -FROM us-docker.pkg.dev/mango-markets/gcr.io/mango-v4:$BASE_TAG +FROM ghcr.io/blockworks-foundation/mango-v4:$BASE_TAG USER mangouser CMD ["settler"]