2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-12-23 18:48:58 +00:00

ci: build multi arch images

This commit is contained in:
Revant Nandgaonkar 2021-01-06 00:14:25 +05:30
parent 94f667caeb
commit 948e1bf00a
3 changed files with 17 additions and 2 deletions

View File

@ -11,12 +11,25 @@ services:
- docker
before_install:
# Install latest docker (https://www.docker.com/blog/multi-arch-build-what-about-travis)
- sudo rm -rf /var/lib/apt/lists/*
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge"
- sudo apt-get update
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
- mkdir -vp ~/.docker/cli-plugins/
- curl --silent -L "https://github.com/docker/buildx/releases/download/v0.5.1/buildx-v0.5.1.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
- chmod a+x ~/.docker/cli-plugins/docker-buildx
- docker buildx create --use
- if [[ "$BUILD" != "development" ]]; then
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin;
sudo apt-get update && sudo apt-get -y install git;
fi
- if [[ $BUILD == "development" ]];then
sudo apt-get update && sudo apt-get -y install docker-compose;
sudo apt-get update && sudo apt-get -y install curl;
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose;
sudo chmod +x /usr/local/bin/docker-compose;
fi
- chmod u+x ./travis.py

View File

@ -40,6 +40,8 @@ RUN apt-get update -y && apt-get install \
wait-for-it \
# For arm64
gcc -y \
&& if [ `uname -m` = 'aarch64' ]; then export ARCH=arm64; fi \
&& if [ `uname -m` = 'x86_64' ]; then export ARCH=amd64; fi \
&& wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_${ARCH}.deb \
&& dpkg -i wkhtmltox_0.12.6-1.buster_${ARCH}.deb && rm wkhtmltox_0.12.6-1.buster_${ARCH}.deb \
&& wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh \

View File

@ -44,7 +44,7 @@ def build(service, tag, image, branch):
build_args += f' --build-arg NODE_IMAGE_TAG=10-buster-slim'
print(f'Building {service} {image} image')
subprocess.run(f'docker build {build_args} -t {service}-{image} -f build/{service}-{image}/Dockerfile .', shell=True)
subprocess.run(f'docker buildx build --platform linux/amd64,linux/arm64 --load {build_args} -t {service}-{image} -f build/{service}-{image}/Dockerfile .', shell=True)
tag_and_push(f'{service}-{image}', tag)