Build/env dev docker 127 (#196)

build: add workflow to create HDK env Docker Image

- make bot username a secret
- update Makefile to pull the HDK image
- have a separate Makefile for the dev specific Docker Image needs
This commit is contained in:
Arthur Meyre
2021-08-25 14:09:54 +02:00
committed by GitHub
parent ff260b2cd2
commit 202dffb4a5
5 changed files with 76 additions and 17 deletions

View File

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

54
.github/workflows/docker-env.yaml vendored Normal file
View File

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

View File

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

View File

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

10
docker/Dockerfile.hdk-env Normal file
View File

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