Use ghcr.io container registry (#549)

* Use ghcr.io container registry

* Update base image urls
This commit is contained in:
riordanp 2023-04-17 16:57:51 +01:00 committed by GitHub
parent a40ceedc97
commit 757a3ee0cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 64 deletions

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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"]

View File

@ -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"]

View File

@ -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"]