Use ghcr.io container registry (#549)
* Use ghcr.io container registry * Update base image urls
This commit is contained in:
parent
a40ceedc97
commit
757a3ee0cc
|
@ -8,8 +8,7 @@ on:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
imageName:
|
imageName:
|
||||||
description: 'Image Name'
|
description: 'Docker Image Name'
|
||||||
description: 'liquidator, keeper, mm, settler'
|
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
imageTag:
|
imageTag:
|
||||||
|
|
|
@ -12,17 +12,11 @@ on:
|
||||||
'bin/liquidator/**',
|
'bin/liquidator/**',
|
||||||
'bin/settler/**',
|
'bin/settler/**',
|
||||||
]
|
]
|
||||||
workflow_call:
|
|
||||||
secrets:
|
|
||||||
GCR_PROJECT:
|
|
||||||
required: true
|
|
||||||
GCR_SA_KEY:
|
|
||||||
required: true
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PROJECT_ID: ${{ secrets.GCR_PROJECT }}
|
|
||||||
IMAGE: mango-v4
|
IMAGE: mango-v4
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -41,21 +35,13 @@ jobs:
|
||||||
install: true
|
install: true
|
||||||
buildkitd-flags: --debug
|
buildkitd-flags: --debug
|
||||||
|
|
||||||
# Login to Google Cloud
|
# Login to Registry
|
||||||
- name: 'Login to Google Cloud'
|
- name: Login to Registry
|
||||||
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
|
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: us-docker.pkg.dev
|
registry: ${{ env.REGISTRY }}
|
||||||
username: oauth2accesstoken
|
username: ${{ github.actor }}
|
||||||
password: ${{ steps.auth.outputs.access_token }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# Build and push the base image, leveraging layer caching
|
# Build and push the base image, leveraging layer caching
|
||||||
- name: Build and Push Base Image
|
- name: Build and Push Base Image
|
||||||
|
@ -64,37 +50,7 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
us-docker.pkg.dev/${{ env.PROJECT_ID }}/gcr.io/${{ env.IMAGE }}:${{ github.sha }}
|
${{ env.REGISTRY }}/blockworks-foundation/${{ env.IMAGE }}:${{ github.sha }}
|
||||||
us-docker.pkg.dev/${{ env.PROJECT_ID }}/gcr.io/${{ env.IMAGE }}:latest
|
${{ env.REGISTRY }}/blockworks-foundation/${{ env.IMAGE }}:latest
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
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
|
|
||||||
|
|
12
Dockerfile
12
Dockerfile
|
@ -1,5 +1,5 @@
|
||||||
# syntax = docker/dockerfile:1.2
|
# 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
|
FROM rust:1.65 as base
|
||||||
# RUN cargo install cargo-chef --locked
|
# RUN cargo install cargo-chef --locked
|
||||||
RUN rustup component add rustfmt
|
RUN rustup component add rustfmt
|
||||||
|
@ -12,15 +12,13 @@ COPY . .
|
||||||
RUN sed -i 's|lib/\*|lib/checked_math|' Cargo.toml
|
RUN sed -i 's|lib/\*|lib/checked_math|' Cargo.toml
|
||||||
# Hack to prevent local serum_dex manifests conflicting with cargo dependency
|
# Hack to prevent local serum_dex manifests conflicting with cargo dependency
|
||||||
RUN rm -rf anchor/tests
|
RUN rm -rf anchor/tests
|
||||||
# RUN cargo chef prepare --bin keeper --recipe-path recipe-keeper.json
|
# RUN cargo chef prepare --recipe-path recipe.json
|
||||||
# RUN cargo chef prepare --bin liquidator --recipe-path recipe-liquidator.json
|
|
||||||
|
|
||||||
FROM base as build
|
FROM base as build
|
||||||
COPY --from=plan /app/recipe-*.json .
|
# COPY --from=plan /app/recipe.json .
|
||||||
COPY . .
|
COPY . .
|
||||||
# RUN cargo chef cook --release --recipe-path recipe-keeper.json --bin keeper
|
# RUN cargo chef cook --release --recipe-path recipe.json
|
||||||
# RUN cargo chef cook --release --recipe-path recipe-liquidator.json --bin liquidator
|
RUN cargo build --release --bins
|
||||||
RUN cargo build --release --bin keeper --bin liquidator --bin settler
|
|
||||||
|
|
||||||
FROM debian:bullseye-slim as run
|
FROM debian:bullseye-slim as run
|
||||||
RUN apt-get update && apt-get -y install ca-certificates libc6
|
RUN apt-get update && apt-get -y install ca-certificates libc6
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# heroku container:push keeper -R -a HEROKU_APP_NAME
|
# heroku container:push keeper -R -a HEROKU_APP_NAME
|
||||||
# heroku container:release -a HEROKU_APP_NAME
|
# heroku container:release -a HEROKU_APP_NAME
|
||||||
ARG BASE_TAG=latest
|
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"]
|
ENTRYPOINT ["keeper"]
|
||||||
USER mangouser
|
USER mangouser
|
||||||
CMD ["crank"]
|
CMD ["crank"]
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
# heroku container:push keeper -R -a HEROKU_APP_NAME
|
# heroku container:push keeper -R -a HEROKU_APP_NAME
|
||||||
# heroku container:release -a HEROKU_APP_NAME
|
# heroku container:release -a HEROKU_APP_NAME
|
||||||
ARG BASE_TAG=latest
|
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
|
USER mangouser
|
||||||
CMD ["liquidator"]
|
CMD ["liquidator"]
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
# heroku container:push keeper -R -a HEROKU_APP_NAME
|
# heroku container:push keeper -R -a HEROKU_APP_NAME
|
||||||
# heroku container:release -a HEROKU_APP_NAME
|
# heroku container:release -a HEROKU_APP_NAME
|
||||||
ARG BASE_TAG=latest
|
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
|
USER mangouser
|
||||||
CMD ["settler"]
|
CMD ["settler"]
|
||||||
|
|
Loading…
Reference in New Issue