Skip to content

Commit

Permalink
build docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
masci committed Feb 19, 2024
1 parent fedf467 commit 8684c25
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 7 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Docker image release

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


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

steps:
- name: Checkout
uses: actions/checkout@v4

- 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: deepset/hayhooks

- name: Build base images
uses: docker/bake-action@v4
env:
IMAGE_TAG_SUFFIX: ${{ steps.meta.outputs.version }}
HAYSTACK_VERSION: ${{ steps.meta.outputs.version }}
with:
workdir: docker
targets: hayhooks
push: true
7 changes: 0 additions & 7 deletions Dockerfile

This file was deleted.

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

FROM $build_image AS build-image

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

ARG hayhooks_version

# Shallow clone Hayhooks repo, we'll install from the local sources
RUN git clone --depth=1 --branch=${hayhooks_version} https://github.com/deepset-ai/hayhooks.git /opt/hayhooks
WORKDIR /opt/hayhooks

# Use a virtualenv we can copy over the next build stage
RUN python3 -m venv --system-site-packages /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

RUN pip install --upgrade pip && \
pip install --no-cache-dir .


FROM $base_image AS final

COPY --from=build-image /opt/venv /opt/venv

EXPOSE 1416

ENV PATH="/opt/venv/bin:$PATH"

CMD ["hayhooks", "run", "0.0.0.0"]
30 changes: 30 additions & 0 deletions docker/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
variable "HAYHOOKS_VERSION" {
default = "main"
}

variable "GITHUB_REF" {
default = ""
}

variable "IMAGE_NAME" {
default = "deepset/hayhooks"
}

variable "IMAGE_TAG_SUFFIX" {
default = "local"
}

variable "BASE_IMAGE_TAG_SUFFIX" {
default = "local"
}

target "default" {
dockerfile = "Dockerfile"
tags = ["${IMAGE_NAME}:${IMAGE_TAG_SUFFIX}"]
args = {
build_image = "deepset/haystack:base-main"
base_image = "deepset/haystack:base-main"
hayhooks_version = "${HAYHOOKS_VERSION}"
}
platforms = ["linux/amd64", "linux/arm64"]
}

0 comments on commit 8684c25

Please sign in to comment.