Skip to content

Commit

Permalink
add bash shell version of the image
Browse files Browse the repository at this point in the history
  • Loading branch information
ndharasz committed Oct 3, 2024
1 parent 0b7dc84 commit d983b60
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/deploy-shell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Deploy Python 3.11 Image

env:
REGISTRY: ghcr.io
IMAGE_NAME: numerai_predict

on:
workflow_dispatch:
push:
branches:
- master

jobs:
public-py311-image:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v2

- name: Extract short git SHA
run: echo "GIT_REF=`git rev-parse --short HEAD`" >> $GITHUB_ENV

- name: Log in to Github Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}_shell

- name: Push Docker image as LATEST to Github Container registry
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
file: ./py3.11/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}_shell:latest
labels: ${{ steps.meta.outputs.labels }}

- name: Push Docker image git ref to Github Container registry
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
file: ./py3.11/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}_shell:${{ env.GIT_REF }}
labels: ${{ steps.meta.outputs.labels }}

internal-py311-image:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.MODEL_UPLOADS_ACCOUNT_ID }}:role/github-actions
aws-region: us-west-2

- name: Build and Push Docker Image
run: ACCOUNT_ID=${{ secrets.MODEL_UPLOADS_ACCOUNT_ID }} make push_latest_shell
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ build_3_10: ## Build Python 3.10 container
build_3_11: ## Build Python 3.11 container
docker build --build-arg GIT_REF=${GIT_REF} -t ${NAME}_py_3_11:${GIT_REF} -t ${NAME}_py_3_11:latest -f py3.11/Dockerfile .

.PHONY: build_shell
build_shell: ## Build Python 3.11 container
docker build --build-arg GIT_REF=${GIT_REF} -t ${NAME}_shell:${GIT_REF} -t ${NAME}_shell:latest -f shell/Dockerfile .

.PHONY: test
test: test_3_9 test_3_10 test_3_11 ## Test all container versions

Expand Down Expand Up @@ -71,6 +75,14 @@ push_latest_3_11: build_3_11## Release Python 3.11 contianer tagged latest
docker push ${ECR_REPO}/${NAME}_py_3_11:${GIT_REF}
docker push ${ECR_REPO}/${NAME}_py_3_11:latest

.PHONY: push_latest_shell
push_latest_shell: build_shell## Release Python 3.11 contianer tagged latest
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${ECR_REPO}
docker tag ${NAME}_shell:${GIT_REF} ${ECR_REPO}/${NAME}_shell:${GIT_REF}
docker tag ${NAME}_shell:latest ${ECR_REPO}/${NAME}_shell:latest
docker push ${ECR_REPO}/${NAME}_shell:${GIT_REF}
docker push ${ECR_REPO}/${NAME}_shell:latest

.PHONY: push_stable
push_stable: push_stable_3_9 push_stable_3_10 push_stable_3_11 ## Push all container tagged stable

Expand Down
16 changes: 16 additions & 0 deletions shell/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.11-slim

ARG GIT_REF
ENV GIT_REF=$GIT_REF
RUN apt-get update -yqq \
&& apt-get install -yqq --no-install-recommends \
build-essential \
cmake \
git \
python3-dev

COPY ./requirements.txt .
RUN pip install --upgrade pip
RUN pip install -r requirements.txt

COPY ./predict.py .

0 comments on commit d983b60

Please sign in to comment.