Skip to content

Commit

Permalink
fix: multi-plaform builds (#4)
Browse files Browse the repository at this point in the history
* chore: add Dockerfile

Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

* fixup! chore: add Dockerfile

fix: syntax issue
Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

* fixup! chore: add Dockerfile

fix: image name syntax error
Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

* fixup! chore: add Dockerfile

fix: add missing update to install wget
Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

* fix: multiplatform docker build

Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

* chore: apply different builds on Go download

Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

* fix(gha): go version added to the image

Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

* fix(gha): go version added to the image

Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

* chore: update Dockerfile"

Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

* chore: test Dockerfile

Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

* chore: testing dockerile arguments

Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

* chore: debugging Dockerfile build arguments

Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

* chore: remove --platform from FROM

Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

* chore: debugging Dockefile

Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

* chore: simplify

Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

* fix: Dockerfile

Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>

---------

Signed-off-by: Kaan Yagci <kaan.yagci@makepad.fr>
Signed-off-by: Kaan Yagci <9104546+kaanyagci@users.noreply.github.com>
  • Loading branch information
kaanyagci authored Mar 29, 2024
1 parent da75560 commit dda5144
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
23 changes: 6 additions & 17 deletions .github/workflows/build_and_push_docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,18 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build Docker image
uses: docker/build-push-action@v5.3.0
with:
context: .
file: Dockerfile
load: true # Change to load for PRs, no push
tags: makepad/go-opencv:${{ matrix.DEBIAN_TAG }}-${{ matrix.OPENCV_VERSION }}
build-args: |
DEBIAN_TAG=${{ matrix.DEBIAN_TAG }}
OPENCV_VERSION=${{ matrix.OPENCV_VERSION }}
GO_VERSION=${{matrix.GO_VERSION}}
- name: Push Docker image
if: github.event_name == 'push'

- name: Build and Push Docker image
uses: docker/build-push-action@v5.3.0
with:
context: .
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64/v8
push: ${{ github.event_name == 'push' }}
tags: makepad/go-opencv:${{ matrix.DEBIAN_TAG }}-opencv-${{ matrix.OPENCV_VERSION }}-go${{ matrix.GO_VERSION }}
build-args: |
DEBIAN_TAG=${{ matrix.DEBIAN_TAG }}
OPENCV_VERSION=${{ matrix.OPENCV_VERSION }}
GO_VERSION=${{matrix.GO_VERSION}}
cache-from: type=registry,ref=makepad/opencv:${{ matrix.DEBIAN_TAG }}-opencv-${{ matrix.OPENCV_VERSION }}-go-${{ matrix.GO_VERSION }}
GO_VERSION=${{ matrix.GO_VERSION }}
cache-from: type=registry,ref=makepad/go-opencv:${{ matrix.DEBIAN_TAG }}-opencv-${{ matrix.OPENCV_VERSION }}-go${{ matrix.GO_VERSION }}
cache-to: type=inline
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
ARG OPENCV_VERSION
ARG DEBIAN_TAG
ARG GO_VERSION

FROM makepad/opencv:${DEBIAN_TAG}-${OPENCV_VERSION}

ARG TARGETOS
ARG TARGETARCH
ARG GO_VERSION

WORKDIR /app


RUN apt-get update -y && \
apt-get install -y wget tar --no-install-recommends && \
wget -q "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" && \
tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz && \
rm ./go${GO_VERSION}.linux-amd64.tar.gz
apt-get install -y wget tar --no-install-recommends && \
wget -q "https://go.dev/dl/go${GO_VERSION}.${TARGETOS}-${TARGETARCH}.tar.gz" && \
tar -C /usr/local -xzf go${GO_VERSION}.${TARGETOS}-${TARGETARCH}.tar.gz && \
rm ./go${GO_VERSION}.${TARGETOS}-${TARGETARCH}.tar.gz

# Set Go environment variables
ENV PATH="${PATH}:/usr/local/go/bin"
Expand Down

0 comments on commit dda5144

Please sign in to comment.