Skip to content

Commit

Permalink
Added changes for Docker image (#277)
Browse files Browse the repository at this point in the history
* Create Dockerfile.base

* Create docker-bake.hcl

* Create docker_release.yml

* Update docker_release.yml
  • Loading branch information
siddheshwar-more authored Mar 28, 2024
1 parent 4ac27d9 commit 2cb120a
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/docker_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Docker image release

on:
push:
tags:
- "v[0-9].[0-9]+.[0-9]+*"

env:
DOCKER_REPO_NAME: "daxa-ai/pebblo"

jobs:
build-and-push:
name: Build base image
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11.x"

- name: Install pypa/build
run: |
pip install build
python -m build --wheel
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: $DOCKER_REPO_NAME

- name: Print Docker Meta
run: |
echo "output version"
echo ${{ steps.meta.outputs.version }}
- name: Build base images
uses: docker/bake-action@v4
env:
IMAGE_TAG_SUFFIX: ${{ steps.meta.outputs.version }}
PEBBLO_VERSION: 'v0.1.12'
with:
workdir: docker
targets: base
push: true


35 changes: 35 additions & 0 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
ARG build_image
ARG base_image
ARG pebblo_version

FROM $build_image AS base

RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
git


RUN mkdir /opt/pebblo
WORKDIR /opt/pebblo

RUN git clone https://github.com/daxa-ai/pebblo.git /opt/pebblo
RUN git checkout $pebblo_version

RUN pip install build
RUN python -m build --wheel

RUN pip install dist/*.whl

# Stage 2
FROM $base_image

RUN mkdir /opt/pebblo /opt/pebblo/log /opt/pebblo/config

WORKDIR /opt/pebblo

COPY --from=base /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages

COPY --from=base /usr/local/bin/pebblo /usr/local/bin/pebblo

ENTRYPOINT ["pebblo"]
34 changes: 34 additions & 0 deletions docker/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
variable "PEBBLO_VERSION" {
default = "main"
}

variable "GITHUB_REF" {
default = ""
}

variable "IMAGE_NAME" {
default = "pebblo"
}

variable "IMAGE_TAG_SUFFIX" {
default = "local"
}

variable "BASE_IMAGE_TAG_SUFFIX" {
default = "local"
}

variable "PEBBLO_EXTRAS" {
default = ""
}

target "base" {
dockerfile = "Dockerfile.base"
tags = ["${IMAGE_NAME}:base-${IMAGE_TAG_SUFFIX}"]
args = {
build_image = "python:3.11"
base_image = "python:3.11"
pebblo_version = "${PEBBLO_VERSION}"
}
platforms = ["linux/amd64", "linux/arm64"]
}

0 comments on commit 2cb120a

Please sign in to comment.