Build linux/amd64 image (#383)
Updates the default build options to build linux/amd64. Fixes #378
This commit is contained in:
parent
34a7a1a80c
commit
5fe9cc51aa
@ -5,14 +5,18 @@ set -ex
|
|||||||
SCRIPT_ROOT=$(dirname $(readlink -f $0))
|
SCRIPT_ROOT=$(dirname $(readlink -f $0))
|
||||||
PROJECT_ROOT=$(dirname ${SCRIPT_ROOT})
|
PROJECT_ROOT=$(dirname ${SCRIPT_ROOT})
|
||||||
|
|
||||||
IMAGE_TAG=$(git describe --tags --always --dirty)
|
OS=linux
|
||||||
|
ARCH=amd64
|
||||||
|
|
||||||
|
IMAGE_TAG=${OS}-${ARCH}-$(git describe --tags --always --dirty)
|
||||||
IMAGE_NAME=alcionai/corso:${IMAGE_TAG}
|
IMAGE_NAME=alcionai/corso:${IMAGE_TAG}
|
||||||
|
|
||||||
${SCRIPT_ROOT}/build.sh
|
${SCRIPT_ROOT}/build.sh
|
||||||
|
|
||||||
echo "building container"
|
echo "building container"
|
||||||
docker build -t ${IMAGE_NAME} \
|
docker buildx --tag ${IMAGE_NAME} \
|
||||||
-f ${PROJECT_ROOT}/Dockerfile \
|
--platform ${OS}/${ARCH} \
|
||||||
|
--file ${PROJECT_ROOT}/Dockerfile \
|
||||||
${PROJECT_ROOT}
|
${PROJECT_ROOT}
|
||||||
|
|
||||||
echo "container built successfully ${IMAGE_NAME}"
|
echo "container built successfully ${IMAGE_NAME}"
|
||||||
|
|||||||
@ -10,6 +10,9 @@ CORSO_BUILD_ARGS=''
|
|||||||
CORSO_BUILD_CONTAINER_DIR=/go/src/github.com/alcionai/corso
|
CORSO_BUILD_CONTAINER_DIR=/go/src/github.com/alcionai/corso
|
||||||
CORSO_BUILD_CONTAINER_SRC_DIR=${CORSO_BUILD_CONTAINER_DIR}/src
|
CORSO_BUILD_CONTAINER_SRC_DIR=${CORSO_BUILD_CONTAINER_DIR}/src
|
||||||
|
|
||||||
|
GOOS=linux
|
||||||
|
GOARCH=amd64
|
||||||
|
|
||||||
# temporary directory for caching go build
|
# temporary directory for caching go build
|
||||||
mkdir -p /tmp/.corsobuild/cache
|
mkdir -p /tmp/.corsobuild/cache
|
||||||
# temporary directory for caching go modules (needed for fast cross-platform build)
|
# temporary directory for caching go modules (needed for fast cross-platform build)
|
||||||
@ -21,6 +24,9 @@ docker run --rm --mount type=bind,src=${SRC_DIR},dst=${CORSO_BUILD_CONTAINER_DIR
|
|||||||
--mount type=bind,src=/tmp/.corsobuild/mod,dst=/go/pkg/mod \
|
--mount type=bind,src=/tmp/.corsobuild/mod,dst=/go/pkg/mod \
|
||||||
--workdir ${CORSO_BUILD_CONTAINER_SRC_DIR} \
|
--workdir ${CORSO_BUILD_CONTAINER_SRC_DIR} \
|
||||||
--env GOCACHE=/tmp/.corsobuild/cache \
|
--env GOCACHE=/tmp/.corsobuild/cache \
|
||||||
|
--env GOOS=${GOOS} \
|
||||||
|
--env GOARCH=${GOARCH} \
|
||||||
|
--env GOCACHE=/tmp/.corsobuild/cache \
|
||||||
--entrypoint /usr/local/go/bin/go \
|
--entrypoint /usr/local/go/bin/go \
|
||||||
golang:1.18 \
|
golang:1.18 \
|
||||||
build ${CORSO_BUILD_ARGS}
|
build ${CORSO_BUILD_ARGS}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user