Skip to content

Commit

Permalink
Merge pull request #282 from Crypto-TII/feature/run-docker-image-with…
Browse files Browse the repository at this point in the history
…out-building

FEATURE: run Docker image without pre-building
  • Loading branch information
peacker authored Oct 3, 2024
2 parents 6f59a19 + 0bdda77 commit 5250c93
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/build-claasp-base-image.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
name: Build and push image for testing
name: Build and push Intel and M1 images for testing
on:
push:
branches:
- main

jobs:
build-image:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -25,11 +28,11 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-
- name: Login dockerhub
- name: Login Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_REGISTRY_USER }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}

- name: Build & Push
uses: docker/build-push-action@v4
Expand All @@ -38,7 +41,7 @@ jobs:
context: .
file: ./docker/Dockerfile
push: true
tags: tiicrc/claasp-base:latest
tags: ${{ matrix.os == 'ubuntu-latest' && 'tiicrc/claasp-base:latest' || 'tiicrc/claasp-m1-base:latest' }}
target: claasp-base
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
Expand Down
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
# Package folder
PACKAGE=claasp

# change to your sage command if needed
# Change to your sage command if needed
SAGE_BIN=`if [ -s SAGE_BIN_PATH ]; then cat SAGE_BIN_PATH; else echo sage; fi`
MODULE?=$(PACKAGE)

DOCKER_IMG_NAME=claasp
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`


all: install
if [ $(CURRENT_BRANCH) == "main" ]; then\
$(SAGE_BIN) setup.py testall;\
Expand All @@ -24,13 +25,23 @@ rundocker: builddocker
docker run -i -p 8887:8887 --mount type=bind,source=`pwd`,target=/home/sage/tii-claasp -t $(DOCKER_IMG_NAME) \
sh -c "cd /home/sage/tii-claasp && make install && cd /home/sage/tii-claasp && exec /bin/bash"

rundockerhub:
docker pull tiicrc/claasp-base \
docker run -i -p 8887:8887 --mount type=bind,source=`pwd`,target=/home/sage/tii-claasp -t $(DOCKER_IMG_NAME) \
sh -c "cd /home/sage/tii-claasp && make install && cd /home/sage/tii-claasp && exec /bin/bash"

builddocker-m1:
docker build -f docker/Dockerfile --platform linux/x86_64 --target claasp-base -t $(DOCKER_IMG_NAME) .

rundocker-m1: builddocker-m1
docker run -i -p 8888:8888 --mount type=bind,source=`pwd`,target=/home/sage/tii-claasp -t $(DOCKER_IMG_NAME) \
sh -c "cd /home/sage/tii-claasp && make install && cd /home/sage/tii-claasp && exec /bin/bash"

rundockerhub-m1:
docker pull tiicrc/claasp-m1-base \
docker run -i -p 8888:8888 --mount type=bind,source=`pwd`,target=/home/sage/tii-claasp -t $(DOCKER_IMG_NAME) \
sh -c "cd /home/sage/tii-claasp && make install && cd /home/sage/tii-claasp && exec /bin/bash"

install:
$(SAGE_BIN) -pip install --upgrade --no-index -v .

Expand Down

0 comments on commit 5250c93

Please sign in to comment.