μ ν¨μ€ λ컀 λ©ν° νλ«νΌ λΉλ
μ ν¨μ€μμ Docker Plugin μ μ¬μ©ν΄μ Dockerfileμ ν΅ν΄ μ½κ² λ컀 μ΄λ―Έμ§λ₯Ό λΉλν μ μλ€. μλ§μ‘΄ μΉ μλΉμ€μ κ°μ ν΄λΌμ°λ μλΉμ€μμλ x86_64(AMD64) μν€ν μ² λΏλ§ μλλΌ ARM64 μν€ν μ² κΈ°λ°μ λ μ λ ΄νκ³ μ±λ₯μ΄ μ’μ μλ²λ₯Ό νμ©ν μ μλ€. κΈ°λ³Έμ μΈ λ컀 μ΄λ―Έμ§ λΉλ λͺ λ Ήμ΄λ λΉλλ₯Ό μλνλ μλ²μ λμΌν μν€ν μ²μ λν μ΄λ―Έμ§λ§ λ§λ€ μ μμΌλ―λ‘ λ©ν° νλ«νΌ μ΄λ―Έμ§λ₯Ό λ§λ€κΈ° μν΄μλ Buildkitμ μ΄μ©ν΄μΌνλ€.
Jenkins μ¬μ©μ λ컀 κ·Έλ£Ήμ μΆκ°
μ ν¨μ€κ° μ€μΉλ μλ²μ μ€νλμ΄μλ λ컀 μμ§μΌλ‘ λΉλν μ μλλ‘ λ컀 κ·Έλ£Ήμ μ ν¨μ€ μ¬μ©μλ₯Ό ν¬ν¨μμΌμΌνλ€. μ ν¨μ€ μ¬μ©μλ₯Ό λ컀 κ·Έλ£Ήμ μΆκ°νκ³ λμλ λ컀μ μ ν¨μ€ λͺ¨λ μ¬μ€νμ μννμ¬μΌ νλ€.
sudo usermod -aG docker jenkins
sudo systemctl restart jenkins
sudo systemctl restart docker
QEMU μ€μΉ
μλμ°μ λ§₯ νκ²½μμ μ¬μ©νλ λ컀 λ°μ€ν¬νμλ QEMU μ ν¬ν¨νκ³ μμ΄ μ½κ² λ©ν° νλ«νΌ μ΄λ―Έμ§λ₯Ό λΉλν μ μλ€. νμ§λ§, μΌλ°μ μΌλ‘ μ ν¨μ€λ₯Ό μ€μΉνλ 리λ μ€ μλ²μμλ QEMUμ λμμ λ°κΈ° μν΄μ μ§μ μ€μΉν΄μΌνλ€.
docker run --privileged --rm tonistiigi/binfmt --install all
Docker Build Cloud λ₯Ό λΉλλ‘ μ΄μ©νκΈ°
Docker Build Cloudλ₯Ό μ΄μ©νμ¬ λΉλνκΈ° μν΄μλ cloud λλΌμ΄λ²λ₯Ό μ§μνλ buildx λ²μ μ μ€μΉν΄μΌνλ€. buildx-desktop μμ 리λ μ€ μλ²μ λ§λ λ°μ΄λ리 νμΌμ λ€μ΄λ°μμ μ ν¨μ€ κ³μ μμ λ°λΌλ³΄λ λ컀 κ²½λ‘μ docker-buildx νλ¬κ·ΈμΈμΌλ‘ μΆκ°νμ.
# μ ν¨μ€ μ¬μ©μλ‘ μ ν
sudo su jenkins -s /bin/bash
# cloud λλΌμ΄λ²λ₯Ό μ§μνλ Buildx μ€μΉ
wget https://github.com/docker/buildx-desktop/releases/download/v0.14.0-desktop.1/buildx-v0.14.0-desktop.1.linux-amd64
mv buildx-v0.14.0-desktop.1.linux-amd64 ~/docker/cli-plugins/docker-buildx
chmod a+x ~/.docker/cli-plugins/docker-buildx
# Buildx λ²μ νμΈ
docker buildx version
github.com/docker/buildx v0.14.0-desktop.1 7b0470cffd54ccbf42976d2f75febc4532c85073
# Docker Build Cloud λΉλ μΆκ°
docker buildx create --driver xxxinc/builder --use
docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
cloud-eipgridinc-ddd* cloud
\_ linux-amd64 \_ cloud://xxxinc/builder_linux-amd64 running v0.13.1 linux/amd64*, linux/amd64/v2, linux/amd64/v3, linux/amd64/v4, linux/386
\_ linux-arm64 \_ cloud://xxxinc/builder_linux-arm64 running v0.13.1 linux/arm64*, linux/arm64/v6, linux/arm64/v7
default docker
\_ default \_ default running v0.8+unknown linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
Docker Build Cloud νκ²½μμ λΉλνλ―λ‘ βbootstrap μ΅μ μΌλ‘ λΉλ μ΄κΈ°νλ₯Ό μνν νμκ° μμ΅λλ€.
Jenkins μμ λΉλνκΈ°
Docker Plugin μμλ buildx λͺ λ Ήμ΄λ₯Ό μ νν μ μκΈ° λλ¬Έμ Execute Shell μ μ νν΄μ μ§μ buildx λͺ λ Ήμ΄λ₯Ό μ¬μ©νλ μ€ν¬λ¦½νΈλ₯Ό μμ±ν΄μΌνλ€. μλμ μ€ν¬λ¦½νΈμμ λ컀 κ³μ μ λ‘κ·ΈμΈνκΈ° μν΄μ μ ν¨μ€ μ¬μ©μμ config.json μ μ΄μ©νκ² νλ€.
# Log in to Docker Hub
echo "Logging into Docker Hub..."
docker login
BUILDER_NAME="cloud-xxxinc-builder"
# Check if the builder already exists
BUILDER_EXISTS=$(docker buildx ls | grep "$BUILDER_NAME" || true)
if [[ -z "$BUILDER_EXISTS" ]]; then
echo "Creating new builder instance..."
docker buildx create --name "$BUILDER_NAME" --driver cloud xxxinc/builder --use
else
echo "Using existing builder instance..."
docker buildx use "$BUILDER_NAME"
fi
# List the builder instances
docker buildx ls
# Install QEMU emulators for building multi-architecture images
docker run --rm --privileged tonistiigi/binfmt --install all
# build
echo "Building Docker image using Buildx with Docker Build Cloud..."
docker buildx build --platform linux/amd64,linux/arm64 -t xxxinc/testapp:${version}-buildx --push .
(Optional) HDF5 for ARM64
ARM64 μν€ν
μ²λ‘ λΉλνλ κ²½μ°μλ§ ValueError: did not find HDF5 headers
κ° λ°μνλ κ²μ κ²½ννλ€. κ²μ κ²°κ³Ό μλμ μΈκ°μ ν¨ν€μ§λ₯Ό μ€μΉνλ κ²μΌλ‘ ν΄κ²°μ΄ λμλ€.
- libhdf5-serial-dev
- netcdf-bin
- libnetcdf-dev
FROM python:3.8-slim-buster
RUN apt-get update && apt-get install -y \
gcc \
libpq-dev \
libhdf5-serial-dev \
netcdf-bin \
libnetcdf-dev