diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index d2931efe7..07e1d1833 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -13,19 +13,15 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/zama-ai/zamalang-compiler + image: ghcr.io/zama-ai/hdk-env credentials: - username: zama-bot + username: ${{ secrets.BOT_USERNAME }} password: ${{ secrets.BOT_TOKEN }} strategy: matrix: python-version: [3.8] steps: - - name: Install Git - run: apt-get install git -y - - name: Install Graphviz - run: apt-get install graphviz* -y - name: Checkout Code uses: actions/checkout@v2 with: @@ -109,7 +105,7 @@ jobs: SLACK_ICON: https://pbs.twimg.com/profile_images/1274014582265298945/OjBKP9kn_400x400.png SLACK_COLOR: ${{ job.status }} SLACK_MESSAGE: 'Build finished with status ${{ job.status }}' - SLACK_USERNAME: zama-bot + SLACK_USERNAME: ${{ secrets.BOT_USERNAME }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} publish-docs: @@ -156,5 +152,5 @@ jobs: SLACK_ICON: https://pbs.twimg.com/profile_images/1274014582265298945/OjBKP9kn_400x400.png SLACK_COLOR: ${{ job.status }} SLACK_MESSAGE: 'Publishing documentation finished with status ${{ job.status }}' - SLACK_USERNAME: zama-bot + SLACK_USERNAME: ${{ secrets.BOT_USERNAME }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} diff --git a/.github/workflows/docker-env.yaml b/.github/workflows/docker-env.yaml new file mode 100644 index 000000000..2b76c14e1 --- /dev/null +++ b/.github/workflows/docker-env.yaml @@ -0,0 +1,54 @@ +name: Docker image (HDK dev/CI) + +on: + push: + branches: + - main + paths: + - docker/Dockerfile.hdk-env + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build_publish: + name: Build & Push the HDK env Docker Image + runs-on: ubuntu-20.04 + env: + IMAGE_URL: ghcr.io/zama-ai/hdk-env + + steps: + - uses: actions/checkout@v2 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ secrets.BOT_USERNAME }} + password: ${{ secrets.BOT_TOKEN }} + - name: Build hdk-env Image + if: ${{ success() && !cancelled() }} + uses: docker/build-push-action@v2 + with: + context: . + builder: ${{ steps.buildx.outputs.name }} + file: docker/Dockerfile.hdk-env + push: true + tags: "${{ env.IMAGE_URL }}:latest" + no-cache: true + + - name: Slack Notification + if: ${{ always() }} + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_CHANNEL: hdk-updates + SLACK_ICON: https://pbs.twimg.com/profile_images/1274014582265298945/OjBKP9kn_400x400.png + SLACK_COLOR: ${{ job.status }} + SLACK_MESSAGE: "Publishing Docker Image ${{ env.IMAGE_URL }} \ + finished with status ${{ job.status }}" + SLACK_USERNAME: ${{ secrets.BOT_USERNAME }} + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + diff --git a/Makefile b/Makefile index 8046b9cf7..25741b9d2 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ SHELL:=/bin/bash +DEV_DOCKER_IMG:=hdk:dev +DEV_DOCKERFILE:=docker/Dockerfile.hdk-dev + setup_env: poetry install poetry run python -m pip install -U pip wheel setuptools @@ -99,16 +102,16 @@ coverage: .PHONY: coverage docker_build: - docker build -t hdk:mlir -f docker/Dockerfile . + docker build -t $(DEV_DOCKER_IMG) -f $(DEV_DOCKERFILE) . .PHONY: docker_build docker_rebuild: - docker build --no-cache -t hdk:mlir -f docker/Dockerfile . + docker build --no-cache -t $(DEV_DOCKER_IMG) -f $(DEV_DOCKERFILE) . .PHONY: docker_rebuild docker_start: @# the slash before pwd is for Windows - docker run --rm -it -p 8888:8888 --volume /"$$(pwd)":/hdk hdk:mlir + docker run --rm -it -p 8888:8888 --volume /"$$(pwd)":/hdk $(DEV_DOCKER_IMG) .PHONY: docker_start docker_build_and_start: docker_build docker_start diff --git a/docker/Dockerfile b/docker/Dockerfile.hdk-dev similarity index 59% rename from docker/Dockerfile rename to docker/Dockerfile.hdk-dev index b3db5a053..70d88956e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile.hdk-dev @@ -1,10 +1,6 @@ -FROM ghcr.io/zama-ai/zamalang-compiler +FROM ghcr.io/zama-ai/hdk-env -RUN apt-get install --no-install-recommends -y \ - python3.8 python3.8-venv python-is-python3 git graphviz* && \ - pip install --no-cache-dir --upgrade pip && \ - pip install --no-cache-dir poetry && \ - echo "source /hdk/.docker_venv/bin/activate" >> /root/.bashrc && \ +RUN echo "source /hdk/.docker_venv/bin/activate" >> /root/.bashrc && \ echo "if [[ \"\$?\" != \"0\" ]]; then" >> /root/.bashrc && \ echo " python3 -m venv /hdk/.docker_venv" >> /root/.bashrc && \ echo " source /hdk/.docker_venv/bin/activate" >> /root/.bashrc && \ diff --git a/docker/Dockerfile.hdk-env b/docker/Dockerfile.hdk-env new file mode 100644 index 000000000..26bf5eea4 --- /dev/null +++ b/docker/Dockerfile.hdk-env @@ -0,0 +1,10 @@ +FROM ghcr.io/zama-ai/zamalang-compiler + +RUN apt-get install --no-install-recommends -y \ + python3.8 \ + python3.8-venv \ + python-is-python3 \ + git \ + graphviz* && \ + pip install --no-cache-dir --upgrade pip && \ + pip install --no-cache-dir poetry