Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ARM64 support for Docker images #951

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .github/workflows/build_and_push_docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ jobs:
run: |
DOCKER_IMAGE_NAME=${{env.DOCKER_REGISTRY}}/${{ inputs.image }}:${{inputs.version}}
echo "DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME}" | tee -a $GITHUB_ENV
DOCKER_BUILDKIT=1 docker build --build-arg OPIK_VERSION=${{inputs.version}} -t ${DOCKER_IMAGE_NAME} .
DOCKER_BUILDKIT=1 docker build --platform linux/amd64,linux/arm64 --build-arg OPIK_VERSION=${{inputs.version}} -t ${DOCKER_IMAGE_NAME} .

- name: Build Docker Image for Comet integration
if: inputs.build_comet_image
run: |
DOCKER_IMAGE_NAME_COMET=${{env.DOCKER_REGISTRY}}/${{inputs.image}}-comet:${{inputs.version}}
echo "DOCKER_IMAGE_NAME_COMET=${DOCKER_IMAGE_NAME_COMET}" | tee -a $GITHUB_ENV
DOCKER_BUILDKIT=1 docker build --build-arg ${{inputs.comet_build_args}} --build-arg OPIK_VERSION=${{inputs.version}} -t ${DOCKER_IMAGE_NAME_COMET} .
DOCKER_BUILDKIT=1 docker build --platform linux/amd64,linux/arm64 --build-arg ${{inputs.comet_build_args}} --build-arg OPIK_VERSION=${{inputs.version}} -t ${DOCKER_IMAGE_NAME_COMET} .

- name: Login to GHCR
uses: docker/login-action@v3
Expand All @@ -72,29 +72,31 @@ jobs:

- name: Push Docker Image
run: |
docker push ${{env.DOCKER_IMAGE_NAME}}
docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 --push -t ${{env.DOCKER_IMAGE_NAME}} .
echo "Docker image pushed: ${{env.DOCKER_IMAGE_NAME}}" >> $GITHUB_STEP_SUMMARY

- name: Push Docker Image with latest tag
if: inputs.push_latest == 'true'
run: |
DOCKER_IMAGE_NAME_LATEST=${{env.DOCKER_REGISTRY}}/${{ inputs.image }}:latest
docker tag ${{env.DOCKER_IMAGE_NAME}} ${DOCKER_IMAGE_NAME_LATEST}
docker push ${DOCKER_IMAGE_NAME_LATEST}
docker buildx build --platform linux/amd64,linux/arm64 --push -t ${DOCKER_IMAGE_NAME_LATEST} .
echo "Docker image pushed: ${DOCKER_IMAGE_NAME_LATEST}" >> $GITHUB_STEP_SUMMARY

- name: Push Docker Image for Comet integration
if: inputs.build_comet_image
run: |
docker push ${{env.DOCKER_IMAGE_NAME_COMET}}
docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 --push -t ${{env.DOCKER_IMAGE_NAME_COMET}} .
echo "Docker image pushed: ${{env.DOCKER_IMAGE_NAME_COMET}}" >> $GITHUB_STEP_SUMMARY

- name: Push Docker Image for Comet integration with latest tag
if: inputs.build_comet_image && inputs.push_latest == 'true'
run: |
DOCKER_IMAGE_NAME_COMET_LATEST=${{env.DOCKER_REGISTRY}}/${{ inputs.image }}-comet:latest
docker tag ${{env.DOCKER_IMAGE_NAME_COMET}} ${DOCKER_IMAGE_NAME_COMET_LATEST}
docker push ${DOCKER_IMAGE_NAME_COMET_LATEST}
docker buildx build --platform linux/amd64,linux/arm64 --push -t ${DOCKER_IMAGE_NAME_COMET_LATEST} .
echo "Docker image pushed: ${DOCKER_IMAGE_NAME_COMET_LATEST}" >> $GITHUB_STEP_SUMMARY



4 changes: 2 additions & 2 deletions apps/opik-backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM maven:3.9.9-amazoncorretto-21-al2023 AS build
FROM --platform=linux/amd64,linux/arm64 maven:3.9.9-amazoncorretto-21-al2023 AS build

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think multiple platforms are supported here.
we will add this to the build and push job. please remove

WORKDIR /opt/opik-backend

Expand All @@ -12,7 +12,7 @@ RUN mvn versions:set -DnewVersion=${OPIK_VERSION} && \
mvn clean package -DskipTests

###############################
FROM amazoncorretto:21-al2023
FROM --platform=linux/amd64,linux/arm64 amazoncorretto:21-al2023

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think multiple platforms are supported here.
we will add this to the build and push job. please remove

RUN yum update -y && yum install -y shadow ca-certificates openssl perl \
&& yum clean all
Expand Down
4 changes: 2 additions & 2 deletions apps/opik-frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build stage
FROM node:20.15.0-alpine3.20 as builder
FROM --platform=linux/amd64,linux/arm64 node:20.15.0-alpine3.20 as builder
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think multiple platforms are supported here.
we will add this to the build and push job. please remove


WORKDIR /opt/frontend

Expand All @@ -17,7 +17,7 @@ ARG BUILD_MODE=production
RUN npm run build -- --mode $BUILD_MODE

# Production stage
FROM nginx:1.27.3-alpine3.20
FROM --platform=linux/amd64,linux/arm64 nginx:1.27.3-alpine3.20
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think multiple platforms are supported here.
we will add this to the build and push job. please remove


# Copy the built files from the builder stage
COPY --from=builder /opt/frontend/dist /usr/share/nginx/html
Expand Down
7 changes: 7 additions & 0 deletions deployment/docker-compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ This will expose the following services to the host machine
- MySQL: Available on port 3306
- Backend: Available on ports 8080 and 3003

## Multi-Architecture Builds
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Multi-Architecture Builds
## Run locally on different architectures (arm/amd)


To build the Opik frontend and backend images for both `linux/amd64` and `linux/arm64` architectures, you can use the following command:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To build the Opik frontend and backend images for both `linux/amd64` and `linux/arm64` architectures, you can use the following command:
To run Opik on different architectures add `platform` for each service in [docker-compose-override.yaml](https://github.com/comet-ml/opik/blob/main/deployment/docker-compose/docker-compose.override.yaml)
`platform: linux/amd64`


```bash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will override in docker-compose please remove

docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 -t <your-image-name> .
```

## Stop opik

Expand Down
2 changes: 2 additions & 0 deletions deployment/docker-compose/docker-compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ services:
ports:
- "8080:8080" # Exposing backend HTTP port to host
- "3003:3003" # Exposing additional backend port to host
platform: linux/amd64,linux/arm64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be optional, only adding an example in docker-compose/README.md file
please remove


frontend:
ports:
- "5173:5173" # Exposing frontend dev server port to host
platform: linux/amd64,linux/arm64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be optional, only adding an example in docker-compose/README.md file
please remove

2 changes: 2 additions & 0 deletions deployment/docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ services:
condition: service_healthy
clickhouse:
condition: service_healthy
platform: linux/amd64,linux/arm64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will add platform as optional in docker-compose-override only if needed
please remove


frontend:
image: ghcr.io/comet-ml/opik/opik-frontend:${OPIK_VERSION:-latest}
Expand All @@ -113,6 +114,7 @@ services:
depends_on:
backend:
condition: service_started
platform: linux/amd64,linux/arm64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will add platform as optional in docker-compose-override only if needed
please remove


networks:
default:
Expand Down
Loading