-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added changes for Docker image (#277)
* Create Dockerfile.base * Create docker-bake.hcl * Create docker_release.yml * Update docker_release.yml
- Loading branch information
1 parent
4ac27d9
commit 2cb120a
Showing
3 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} |