Skip to content

Commit

Permalink
Add docker build as part of checks for x64/arm64 (opensearch-project#601
Browse files Browse the repository at this point in the history
)

Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon authored Jul 31, 2024
1 parent 4baf6d4 commit 31fbe72
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 46 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Docker Build and Test
on:
pull_request:
workflow_dispatch:
inputs:
logLevel:
description: Log level
required: true
default: warning
type: choice
options:
- info
- warning
- debug

jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
architecture: ['linux/amd64', 'linux/arm64']
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: 'v0.9.1'
- uses: actions/checkout@v4
with:
path: 'opensearch-benchmark-git'
- name: Docker Build and Test on ${{ matrix.architecture }}
run: |
docker buildx version
cp -a opensearch-benchmark-git/* ./
echo "Disable VERSION arg to enter docker build test mode"
docker buildx build --platform ${{ matrix.architecture }} --build-arg BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` -f "docker/Dockerfile" .
42 changes: 0 additions & 42 deletions .github/workflows/docker.yml

This file was deleted.

16 changes: 12 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
###############################################################################

FROM python:3.11.2-slim
ARG VERSION
ARG VERSION=testing

ENV BENCHMARK_RUNNING_IN_DOCKER True
ENV BENCHMARK_RUNNING_IN_DOCKER=True

WORKDIR /opensearch-benchmark

RUN apt-get -y update && \
apt-get install -y curl git gcc pbzip2 pigz && \
Expand All @@ -16,9 +18,15 @@ RUN groupadd --gid 1000 opensearch-benchmark && \
useradd -d /opensearch-benchmark -m -k /dev/null -g 1000 -N -u 1000 -l -s /bin/bash benchmark

ENV PIP_ONLY_BINARY=h5py
RUN if [ -z "$VERSION" ] ; then python3 -m pip install opensearch-benchmark ; else python3 -m pip install opensearch-benchmark==$VERSION ; fi

WORKDIR /opensearch-benchmark
# Copy file for test purpose and will remove during prod publishing
COPY opensearch-benchmark-git/ ./opensearch-benchmark-git

# Currently we always have the $VERSION arg substituted during prod publishing
# Default VERSION=testing to enter test mode based on user inputs.
RUN if [ "$VERSION" = "testing" ] ; then echo Testing; cp -a opensearch-benchmark-git/* ./; ls -l; python3 -m pip install -e . ; \
else echo Production; rm -rf opensearch-benchmark-git; ls -l; python3 -m pip install opensearch-benchmark==$VERSION ; fi


RUN mkdir -p /opensearch-benchmark/.benchmark && \
chown -R 1000:0 /opensearch-benchmark/.benchmark
Expand Down

0 comments on commit 31fbe72

Please sign in to comment.