Skip to content

Commit

Permalink
Merge pull request #48 from openyurtio/multiple_platform_build
Browse files Browse the repository at this point in the history
add support for multiple arch dashboard build
  • Loading branch information
rambohe-ch authored Oct 30, 2023
2 parents 9391a0e + 8be3005 commit ca19307
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18 as builder
FROM --platform=$TARGETPLATFORM golang:1.18 as builder

ENV GOPROXY https://goproxy.cn,direct
WORKDIR /workspace
Expand All @@ -8,7 +8,7 @@ COPY backend/ /workspace
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod readonly -a -o apiserver ./proxy_server/

##Build ui
FROM node:14.17.6-alpine3.14 as build-ui
FROM --platform=$BUILDPLATFORM node:14.17.6-alpine3.14 as build-ui

#RUN apk update && apk add bash

Expand All @@ -21,7 +21,7 @@ COPY frontend/package.json .
RUN npm install
RUN npm run build

FROM centos:7
FROM --platform=$TARGETPLATFORM centos:7
# FROM alpine:3.12.0

WORKDIR /openyurt/backend/
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ SHELL = /usr/bin/env bash -o pipefail

REPO ?= openyurt
IMAGE_TAG ?= latest
TARGETPLATFORM ?= linux/amd64

DASHBOARD_IMG ?= ${REPO}/yurt-dashboard:${IMAGE_TAG}

DOCKER_BUILD_GO_PROXY_ARG ?= GO_PROXY=https://goproxy.cn,direct


docker-build:
docker build -f Dockerfile . -t ${DASHBOARD_IMG} \
--build-arg ${DOCKER_BUILD_GO_PROXY_ARG}
docker buildx build --load \
-f Dockerfile . -t ${DASHBOARD_IMG} \
--platform ${TARGETPLATFORM} --build-arg ${DOCKER_BUILD_GO_PROXY_ARG}

docker-push:
docker push ${DASHBOARD_IMG}

0 comments on commit ca19307

Please sign in to comment.